Class Mqttv3ClientManager
java.lang.Object
org.springframework.integration.mqtt.core.AbstractMqttClientManager<org.eclipse.paho.client.mqttv3.IMqttAsyncClient,org.eclipse.paho.client.mqttv3.MqttConnectOptions>
org.springframework.integration.mqtt.core.Mqttv3ClientManager
- All Implemented Interfaces:
org.eclipse.paho.client.mqttv3.MqttCallback,org.eclipse.paho.client.mqttv3.MqttCallbackExtended,Aware,BeanNameAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,ClientManager<org.eclipse.paho.client.mqttv3.IMqttAsyncClient,,org.eclipse.paho.client.mqttv3.MqttConnectOptions> MqttComponent<org.eclipse.paho.client.mqttv3.MqttConnectOptions>
public class Mqttv3ClientManager
extends AbstractMqttClientManager<org.eclipse.paho.client.mqttv3.IMqttAsyncClient,org.eclipse.paho.client.mqttv3.MqttConnectOptions>
implements org.eclipse.paho.client.mqttv3.MqttCallbackExtended
A client manager implementation for MQTT v3 protocol. Requires a client ID and server URI.
If needed, the connection options may be overridden and passed as a
MqttConnectOptions dependency.
By default, automatic reconnect is used. If it is required to be turned off, one should listen for
MqttConnectionFailedEvent and reconnect the MQTT client manually.- Since:
- 6.0
- Author:
- Artem Vozhdayenko
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.mqtt.core.ClientManager
ClientManager.ConnectCallback -
Field Summary
Fields inherited from class org.springframework.integration.mqtt.core.AbstractMqttClientManager
loggerFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionMqttv3ClientManager(String url, String clientId) Mqttv3ClientManager(org.eclipse.paho.client.mqttv3.MqttConnectOptions connectionOptions, String clientId) -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectComplete(boolean reconnect, String serverURI) voidconnectionLost(Throwable cause) voiddeliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) org.eclipse.paho.client.mqttv3.MqttConnectOptionsReturn information about the connection.voidmessageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage message) voidsetPersistence(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence) Set theMqttClientPersistencefor a client.voidstart()voidstop()Methods inherited from class org.springframework.integration.mqtt.core.AbstractMqttClientManager
addCallback, getApplicationEventPublisher, getBeanName, getCallbacks, getClient, getClientId, getPhase, getUrl, isManualAcks, isRunning, removeCallback, setApplicationEventPublisher, setBeanName, setClient, setManualAcks, setPhase, setUrlMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup, stop
-
Constructor Details
-
Mqttv3ClientManager
-
Mqttv3ClientManager
public Mqttv3ClientManager(org.eclipse.paho.client.mqttv3.MqttConnectOptions connectionOptions, String clientId)
-
-
Method Details
-
setPersistence
public void setPersistence(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence) Set theMqttClientPersistencefor a client.- Parameters:
persistence- persistence implementation to use for te client
-
getConnectionInfo
public org.eclipse.paho.client.mqttv3.MqttConnectOptions getConnectionInfo()Description copied from interface:MqttComponentReturn information about the connection.- Specified by:
getConnectionInfoin interfaceMqttComponent<org.eclipse.paho.client.mqttv3.MqttConnectOptions>- Returns:
- the information.
-
start
public void start() -
stop
public void stop() -
connectionLost
- Specified by:
connectionLostin interfaceorg.eclipse.paho.client.mqttv3.MqttCallback
-
connectComplete
- Specified by:
connectCompletein interfaceorg.eclipse.paho.client.mqttv3.MqttCallbackExtended
-
messageArrived
- Specified by:
messageArrivedin interfaceorg.eclipse.paho.client.mqttv3.MqttCallback
-
deliveryComplete
public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) - Specified by:
deliveryCompletein interfaceorg.eclipse.paho.client.mqttv3.MqttCallback
-