Class Mqttv5ClientManager
java.lang.Object
org.springframework.integration.mqtt.core.AbstractMqttClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
org.springframework.integration.mqtt.core.Mqttv5ClientManager
- All Implemented Interfaces:
org.eclipse.paho.mqttv5.client.MqttCallback,Aware,BeanNameAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
public class Mqttv5ClientManager
extends AbstractMqttClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
implements org.eclipse.paho.mqttv5.client.MqttCallback
A client manager implementation for MQTT v5 protocol. Requires a client ID and server URI.
If needed, the connection options may be overridden and passed as a
MqttConnectionOptions 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, Artem Bilan
-
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
ConstructorsConstructorDescriptionMqttv5ClientManager(String url, String clientId) Mqttv5ClientManager(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId) -
Method Summary
Modifier and TypeMethodDescriptionvoidauthPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) voidconnectComplete(boolean reconnect, String serverURI) voiddeliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) voiddisconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) org.eclipse.paho.mqttv5.client.MqttConnectionOptionsReturn information about the connection.voidmessageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message) voidmqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) voidsetPersistence(org.eclipse.paho.mqttv5.client.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
-
Mqttv5ClientManager
-
Mqttv5ClientManager
public Mqttv5ClientManager(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId)
-
-
Method Details
-
setPersistence
public void setPersistence(org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence) Set theMqttClientPersistencefor a client.- Parameters:
persistence- persistence implementation to use for te client
-
getConnectionInfo
public org.eclipse.paho.mqttv5.client.MqttConnectionOptions getConnectionInfo()Description copied from interface:MqttComponentReturn information about the connection.- Specified by:
getConnectionInfoin interfaceMqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>- Returns:
- the information.
-
start
public void start() -
stop
public void stop() -
messageArrived
- Specified by:
messageArrivedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
deliveryComplete
public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) - Specified by:
deliveryCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
connectComplete
- Specified by:
connectCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
authPacketArrived
public void authPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) - Specified by:
authPacketArrivedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
disconnected
public void disconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) - Specified by:
disconnectedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
mqttErrorOccurred
public void mqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) - Specified by:
mqttErrorOccurredin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-