|
||||||||||
| 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,
Executor executor,
boolean synchronous)
Constructs an object to create synchronous or asynchronous clients using a user provided Executor with the default
config. |
|
MqttClientFactory(String brokerUri,
Executor executor,
boolean synchronous,
MqttClientConfig config)
Constructs an object to create synchronous or asynchronous clients using a user provided Executor with a custom
config. |
|
MqttClientFactory(String brokerUri,
int messageHandlerThreadPoolSize,
boolean synchronous)
Constructs an object to create synchronous or asynchronous clients using an Executor owned by this class with the default
config. |
|
MqttClientFactory(String brokerUri,
int messageHandlerThreadPoolSize,
boolean synchronous,
MqttClientConfig config)
Constructs an object to create synchronous or asynchronous clients using an Executor owned by this class with a custom
config. |
|
| 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,
int messageHandlerThreadPoolSize,
boolean synchronous)
clients using an Executor owned by this class with the default
config.
brokerUri - The URL to the broker to connect to. For example, tcp://q.m2m.io:1883messageHandlerThreadPoolSize - The number of threads used to handle incoming messages and invoke the listener's methodssynchronous - True to create synchronous clients, false to create asynchronous clients. If true then the synchronous clients' blockingTimeoutSeconds will be
0 (wait forever).
public MqttClientFactory(String brokerUri,
Executor executor,
boolean synchronous)
clients using a user provided Executor with the default
config.
brokerUri - The URL to the broker to connect to. For example, tcp://q.m2m.io:1883executor - The executor used to handle incoming messages and invoke the listener's methods. This class will NOT shut down the executor.synchronous - True to create synchronous clients, false to create asynchronous clients. If true then the synchronous clients' blockingTimeoutSeconds will be
0 (wait forever).
public MqttClientFactory(String brokerUri,
int messageHandlerThreadPoolSize,
boolean synchronous,
MqttClientConfig config)
clients using an Executor owned by this class with a custom
config.
brokerUri - The URL to the broker to connect to. For example, tcp://q.m2m.io:1883messageHandlerThreadPoolSize - The number of threads used to handle incoming messages and invoke the listener's methodssynchronous - True to create synchronous clients, false to create asynchronous clients.config - The configuration for the client
public MqttClientFactory(String brokerUri,
Executor executor,
boolean synchronous,
MqttClientConfig config)
clients using a user provided Executor with a custom
config.
brokerUri - The URL to the broker to connect to. For example, tcp://q.m2m.io:1883executor - The executor used to handle incoming messages and invoke the listener's methods. This class will NOT shut down the executor.synchronous - True to create synchronous clients, false to create asynchronous clients.config - The configuration for the client| Method Detail |
|---|
public void shutdown()
AsyncClientFactory
shutdown in interface AsyncClientFactoryshutdown in interface SyncClientFactorySyncClientFactory.shutdown(),
AsyncClientFactory.shutdown()
public MqttClient newSynchronousClient(MqttClientListener mqttClientListener)
throws IllegalStateException
SyncClientFactoryclient. You may only use this method if the factory was constructed to create synchronous clients.
newSynchronousClient in interface SyncClientFactorymqttClientListener - Handles events from this client's channel. Use MqttClientListener.NULL_LISTENER if you don't want to receive messages or be notified
of events.
client
IllegalStateException - If this factory was constructed to create asynchronous clients and not synchronous clients.SyncClientFactory.newSynchronousClient(net.sf.xenqtt.client.MqttClientListener)
public MqttClient newAsyncClient(AsyncClientListener asyncClientListener)
throws IllegalStateException
AsyncClientFactoryclient. You may only use this method if the factory was constructed to create asynchronous clients.
newAsyncClient in interface AsyncClientFactoryasyncClientListener - Handles events from this client's channel. Use AsyncClientListener.NULL_LISTENER if you don't want to receive messages or be notified
of events.
client
IllegalStateException - If this factory was constructed to create synchronous clients and not asynchronous clients.AsyncClientFactory.newAsyncClient(net.sf.xenqtt.client.AsyncClientListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||