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, Christian Tzolov, Jiri Soucek
  • Constructor Details

    • Mqttv5ClientManager

      public Mqttv5ClientManager(String url, String clientId)
    • 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 the MqttClientPersistence for a client.
      Parameters:
      persistence - persistence implementation to use for te client
    • getConnectionInfo

      public org.eclipse.paho.mqttv5.client.MqttConnectionOptions getConnectionInfo()
      Description copied from interface: MqttComponent
      Return information about the connection.
      Specified by:
      getConnectionInfo in interface MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
      Returns:
      the information.
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • messageArrived

      public void messageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message)
      Specified by:
      messageArrived in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • deliveryComplete

      public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token)
      Specified by:
      deliveryComplete in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • connectComplete

      public void connectComplete(boolean reconnect, String serverURI)
      Specified by:
      connectComplete in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • authPacketArrived

      public void authPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties)
      Specified by:
      authPacketArrived in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • disconnected

      public void disconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse)
      Specified by:
      disconnected in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • mqttErrorOccurred

      public void mqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception)
      Specified by:
      mqttErrorOccurred in interface org.eclipse.paho.mqttv5.client.MqttCallback
    • isConnected

      public boolean isConnected()
      Description copied from interface: ClientManager
      Return the managed clients isConnected.
      Specified by:
      isConnected in interface ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
      Returns:
      the managed clients isConnected.