|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xenqtt.client.MqttClientFactory
public final class MqttClientFactory
Used to create multiple "sibling" clients
that share an Executor
, broker URI, etc.
Constructor Summary | |
---|---|
MqttClientFactory(String brokerUri,
ReconnectionStrategy reconnectionStrategy,
Executor executor,
int connectTimeoutSeconds,
int messageResendIntervalSeconds)
Constructs an object to create asynchronous clients using a user provided Executor . |
|
MqttClientFactory(String brokerUri,
ReconnectionStrategy reconnectionStrategy,
Executor executor,
int connectTimeoutSeconds,
int messageResendIntervalSeconds,
int blockingTimeoutSeconds)
Constructs an object to create synchronous clients using a user provided Executor . |
|
MqttClientFactory(String brokerUri,
ReconnectionStrategy reconnectionStrategy,
int messageHandlerThreadPoolSize,
int connectTimeoutSeconds,
int messageResendIntervalSeconds)
Constructs an object to create asynchronous clients using an Executor owned by this class. |
|
MqttClientFactory(String brokerUri,
ReconnectionStrategy reconnectionStrategy,
int messageHandlerThreadPoolSize,
int connectTimeoutSeconds,
int messageResendIntervalSeconds,
int blockingTimeoutSeconds)
Constructs an object to create synchronous clients using an Executor owned by this class. |
Method Summary | |
---|---|
MqttClient |
newAsyncClient(AsyncClientListener asyncClientListener)
Creates an asynchronous client . |
MqttClient |
newSynchronousClient(MqttClientListener mqttClientListener)
Creates a synchronous client . |
void |
shutdown()
Stops this factory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MqttClientFactory(String brokerUri, ReconnectionStrategy reconnectionStrategy, int messageHandlerThreadPoolSize, int connectTimeoutSeconds, int messageResendIntervalSeconds, int blockingTimeoutSeconds)
clients
using an Executor
owned by this class.
brokerUri
- The URL to the broker to connect to. For example, tcp://q.m2m.io:1883reconnectionStrategy
- The algorithm used to reconnect to the broker if the connection is lostmessageHandlerThreadPoolSize
- The number of threads used to handle incoming messages and invoke the listener's
methodsconnectTimeoutSeconds
- Seconds to wait for an ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.messageResendIntervalSeconds
- Seconds between attempts to resend a message that is MqttMessage.isAckable()
. 0 to disable message resendsblockingTimeoutSeconds
- Seconds until a blocked method invocation times out and an MqttTimeoutException
is thrown. -1 will create a non-blocking API, 0 will
create a blocking API with no timeout, > 0 will create a blocking API with the specified timeout.public MqttClientFactory(String brokerUri, ReconnectionStrategy reconnectionStrategy, Executor executor, int connectTimeoutSeconds, int messageResendIntervalSeconds, int blockingTimeoutSeconds)
clients
using a user provided Executor
.
brokerUri
- The URL to the broker to connect to. For example, tcp://q.m2m.io:1883reconnectionStrategy
- The algorithm used to reconnect to the broker if the connection is lostexecutor
- The executor used to handle incoming messages and invoke the listener's
methods. This class will NOT shut down the
executor.connectTimeoutSeconds
- Seconds to wait for an ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.messageResendIntervalSeconds
- Seconds between attempts to resend a message that is MqttMessage.isAckable()
. 0 to disable message resendsblockingTimeoutSeconds
- Seconds until a blocked method invocation times out and an MqttTimeoutException
is thrown. -1 will create a non-blocking API, 0 will
create a blocking API with no timeout, > 0 will create a blocking API with the specified timeout.public MqttClientFactory(String brokerUri, ReconnectionStrategy reconnectionStrategy, int messageHandlerThreadPoolSize, int connectTimeoutSeconds, int messageResendIntervalSeconds)
clients
using an Executor
owned by this class.
brokerUri
- The URL to the broker to connect to. For example, tcp://q.m2m.io:1883reconnectionStrategy
- The algorithm used to reconnect to the broker if the connection is lostmessageHandlerThreadPoolSize
- The number of threads used to handle incoming messages and invoke the listener's
methodsconnectTimeoutSeconds
- Seconds to wait for an ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.messageResendIntervalSeconds
- Seconds between attempts to resend a message that is MqttMessage.isAckable()
. 0 to disable message resendspublic MqttClientFactory(String brokerUri, ReconnectionStrategy reconnectionStrategy, Executor executor, int connectTimeoutSeconds, int messageResendIntervalSeconds)
clients
using a user provided Executor
.
brokerUri
- The URL to the broker to connect to. For example, tcp://q.m2m.io:1883reconnectionStrategy
- The algorithm used to reconnect to the broker if the connection is lostexecutor
- The executor used to handle incoming messages and invoke the listener's
methods. This class will NOT shut down the
executor.connectTimeoutSeconds
- Seconds to wait for an ack
to a connect message
before timing out and closing the channel. 0 to
wait forever.messageResendIntervalSeconds
- Seconds between attempts to resend a message that is MqttMessage.isAckable()
. 0 to disable message resendsblockingTimeoutSeconds
- Seconds until a blocked method invocation times out and an MqttTimeoutException
is thrown. -1 will create a non-blocking API, 0 will
create a blocking API with no timeout, > 0 will create a blocking API with the specified timeout.Method Detail |
---|
public void shutdown()
public MqttClient newSynchronousClient(MqttClientListener mqttClientListener) throws IllegalStateException
client
. You may only use this method if the factory was constructed to create synchronous clients.
mqttClientListener
- Handles events from this client's channel
client
IllegalStateException
- If this factory was constructed to create asynchronous clients and not synchronous clients.public MqttClient newAsyncClient(AsyncClientListener asyncClientListener) throws IllegalStateException
client
. You may only use this method if the factory was constructed to create asynchronous clients.
asyncClientListener
- Handles events from this client's channel
client
IllegalStateException
- If this factory was constructed to create synchronous clients and not asynchronous clients.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |