public class DefaultMqttPahoClientFactory extends java.lang.Object implements MqttPahoClientFactory
MqttClient
and a set of options as configured.Modifier and Type | Class and Description |
---|---|
static class |
DefaultMqttPahoClientFactory.Will |
Constructor and Description |
---|
DefaultMqttPahoClientFactory() |
Modifier and Type | Method and Description |
---|---|
org.eclipse.paho.client.mqttv3.IMqttAsyncClient |
getAsyncClientInstance(java.lang.String uri,
java.lang.String clientId)
Retrieve an async client instance.
|
org.eclipse.paho.client.mqttv3.IMqttClient |
getClientInstance(java.lang.String uri,
java.lang.String clientId)
Retrieve a client instance.
|
org.eclipse.paho.client.mqttv3.MqttConnectOptions |
getConnectionOptions()
Retrieve the connection options.
|
ConsumerStopAction |
getConsumerStopAction()
Get the consumer stop action.
|
void |
setCleanSession(java.lang.Boolean cleanSession) |
void |
setConnectionTimeout(java.lang.Integer connectionTimeout) |
void |
setConsumerStopAction(ConsumerStopAction consumerStopAction)
Set the consumer stop action.
|
void |
setKeepAliveInterval(java.lang.Integer keepAliveInterval) |
void |
setPassword(java.lang.String password) |
void |
setPersistence(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence) |
void |
setServerURIs(java.lang.String... serverURIs)
Use this when using multiple server instances, for example when using HA.
|
void |
setSocketFactory(javax.net.SocketFactory socketFactory) |
void |
setSslProperties(java.util.Properties sslProperties) |
void |
setUserName(java.lang.String userName) |
void |
setWill(DefaultMqttPahoClientFactory.Will will)
Will be used to set the "Last Will and Testament" (LWT) for the connection.
|
public void setCleanSession(java.lang.Boolean cleanSession)
public void setConnectionTimeout(java.lang.Integer connectionTimeout)
public void setKeepAliveInterval(java.lang.Integer keepAliveInterval)
public void setPassword(java.lang.String password)
public void setSocketFactory(javax.net.SocketFactory socketFactory)
public void setSslProperties(java.util.Properties sslProperties)
public void setUserName(java.lang.String userName)
public void setWill(DefaultMqttPahoClientFactory.Will will)
will
- The will.MqttConnectOptions.setWill(org.eclipse.paho.client.mqttv3.MqttTopic, byte[], int, boolean)
public void setPersistence(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence)
public void setServerURIs(java.lang.String... serverURIs)
serverURIs
- The URIs.MqttConnectOptions.setServerURIs(String[])
public ConsumerStopAction getConsumerStopAction()
getConsumerStopAction
in interface MqttPahoClientFactory
public void setConsumerStopAction(ConsumerStopAction consumerStopAction)
ConsumerStopAction.UNSUBSCRIBE_CLEAN
.consumerStopAction
- the consumer stop action.public org.eclipse.paho.client.mqttv3.IMqttClient getClientInstance(java.lang.String uri, java.lang.String clientId) throws org.eclipse.paho.client.mqttv3.MqttException
MqttPahoClientFactory
getClientInstance
in interface MqttPahoClientFactory
uri
- The URL.clientId
- The client id.org.eclipse.paho.client.mqttv3.MqttException
- Any.public org.eclipse.paho.client.mqttv3.IMqttAsyncClient getAsyncClientInstance(java.lang.String uri, java.lang.String clientId) throws org.eclipse.paho.client.mqttv3.MqttException
MqttPahoClientFactory
getAsyncClientInstance
in interface MqttPahoClientFactory
uri
- The URL.clientId
- The client id.org.eclipse.paho.client.mqttv3.MqttException
- Any.public org.eclipse.paho.client.mqttv3.MqttConnectOptions getConnectionOptions()
MqttPahoClientFactory
getConnectionOptions
in interface MqttPahoClientFactory