public class ConnectionFactory extends Object
ConnectionFactory object encapsulates a set of connection configuration options. A
client uses it to create a connection to the STAN streaming data system.| Constructor and Description |
|---|
ConnectionFactory() |
ConnectionFactory(String clusterId,
String clientId) |
| Modifier and Type | Method and Description |
|---|---|
Connection |
createConnection()
Creates an active connection to a NATS Streaming server.
|
Duration |
getAckTimeout()
Returns the ACK timeout.
|
String |
getClientId()
Returns the client ID of the current STAN session.
|
String |
getClusterId()
Returns the cluster ID of the current STAN session.
|
Duration |
getConnectTimeout()
Returns the connect timeout interval in milliseconds.
|
String |
getDiscoverPrefix()
Returns the currently configured discover prefix string.
|
int |
getMaxPubAcksInFlight()
Returns the maximum number of publish ACKs that may be in flight at any point in time.
|
io.nats.client.Connection |
getNatsConnection()
Returns the NATS Connection, if set.
|
String |
getNatsUrl()
Returns the NATS connection URL.
|
void |
setAckTimeout(Duration ackTimeout)
Sets the ACK timeout duration.
|
void |
setAckTimeout(long ackTimeout,
TimeUnit unit)
Sets the ACK timeout in the specified time unit.
|
void |
setClientId(String clientId)
Sets the client ID for the current STAN session.
|
void |
setClusterId(String clusterId)
Sets the cluster ID of the current STAN session.
|
void |
setConnectTimeout(Duration connectTimeout)
Sets the connect timeout duration.
|
void |
setConnectTimeout(long connectTimeout,
TimeUnit unit)
Sets the connect timeout in the specified time unit.
|
void |
setDiscoverPrefix(String discoverPrefix)
Sets the discover prefix string that is used to establish a STAN session.
|
void |
setMaxPubAcksInFlight(int maxPubAcksInFlight)
Sets the maximum number of publish ACKs that may be in flight at any point in time.
|
void |
setNatsConnection(io.nats.client.Connection natsConn)
Sets the NATS Connection.
|
void |
setNatsUrl(String natsUrl)
Sets the NATS URL.
|
public Connection createConnection() throws IOException, TimeoutException
IOException - if a Connection cannot be established for some reason.TimeoutException - if the connection timeout has been exceeded.public Duration getAckTimeout()
public void setAckTimeout(Duration ackTimeout)
ackTimeout - the ackTimeout to setpublic void setAckTimeout(long ackTimeout,
TimeUnit unit)
ackTimeout - the ackTimeout to setunit - the time unit to setpublic Duration getConnectTimeout()
public void setConnectTimeout(Duration connectTimeout)
connectTimeout - the connectTimeout to setpublic void setConnectTimeout(long connectTimeout,
TimeUnit unit)
connectTimeout - the connectTimeout to setunit - the time unit to setpublic String getDiscoverPrefix()
public void setDiscoverPrefix(String discoverPrefix)
discoverPrefix - the discoverPrefix to setpublic int getMaxPubAcksInFlight()
public void setMaxPubAcksInFlight(int maxPubAcksInFlight)
maxPubAcksInFlight - the maxPubAcksInFlight to setpublic String getNatsUrl()
public void setNatsUrl(String natsUrl)
natsUrl - the natsUrl to setpublic io.nats.client.Connection getNatsConnection()
public void setNatsConnection(io.nats.client.Connection natsConn)
natsConn - the NATS connection to setpublic String getClientId()
public void setClientId(String clientId)
clientId - the clientId to setpublic String getClusterId()
public void setClusterId(String clusterId)
clusterId - the clusterId to setCopyright © 2016 Apcera, Inc.. All rights reserved.