Class Mqttv5PahoMessageHandler

All Implemented Interfaces:
org.eclipse.paho.mqttv5.client.MqttCallback, org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ApplicationEventPublisherAware, Lifecycle, Ordered, ComponentSourceAware, ExpressionCapable, Orderable, IntegrationPattern, MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>, NamedComponent, IntegrationManagement, ManageableLifecycle, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class Mqttv5PahoMessageHandler extends AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> implements org.eclipse.paho.mqttv5.client.MqttCallback, MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
The AbstractMqttMessageHandler implementation for MQTT v5.
Since:
5.5.5
Author:
Artem Bilan, Lucas Bowler, Artem Vozhdayenko
  • Constructor Details

    • Mqttv5PahoMessageHandler

      public Mqttv5PahoMessageHandler(String url, String clientId)
    • Mqttv5PahoMessageHandler

      public Mqttv5PahoMessageHandler(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId)
    • Mqttv5PahoMessageHandler

      public Mqttv5PahoMessageHandler(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager)
      Use this constructor when you need to use a single ClientManager (for instance, to reuse an MQTT connection).
      Parameters:
      clientManager - The client manager.
      Since:
      6.0
  • Method Details

    • 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.
    • setPersistence

      public void setPersistence(@Nullable org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence)
    • setHeaderMapper

      public void setHeaderMapper(HeaderMapper<org.eclipse.paho.mqttv5.common.packet.MqttProperties> headerMapper)
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
    • doStart

      protected void doStart()
      Specified by:
      doStart in class AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
    • doStop

      protected void doStop()
      Specified by:
      doStop in class AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
    • destroy

      public void destroy()
      Specified by:
      destroy in interface DisposableBean
      Specified by:
      destroy in interface IntegrationManagement
      Overrides:
      destroy in class MessageHandlerSupport
    • handleMessageInternal

      protected void handleMessageInternal(Message<?> message)
      Overrides:
      handleMessageInternal in class AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
    • publish

      protected void publish(String topic, Object mqttMessage, Message<?> message)
      Specified by:
      publish in class AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
    • deliveryComplete

      public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token)
      Specified by:
      deliveryComplete 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
    • messageArrived

      public void messageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message)
      Specified by:
      messageArrived 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