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

    • Mqttv3ClientManager

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

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

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

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

      public void connectionLost(Throwable cause)
      Specified by:
      connectionLost in interface org.eclipse.paho.client.mqttv3.MqttCallback
    • connectComplete

      public void connectComplete(boolean reconnect, String serverURI)
      Specified by:
      connectComplete in interface org.eclipse.paho.client.mqttv3.MqttCallbackExtended
    • messageArrived

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

      public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
      Specified by:
      deliveryComplete in interface org.eclipse.paho.client.mqttv3.MqttCallback
    • isConnected

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