Class AbstractMqttMessageDrivenChannelAdapter<T,C>

Type Parameters:
T - MQTT Client type
C - MQTT connection options type (v5 or v3)
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, SmartInitializingSingleton, ApplicationContextAware, ApplicationEventPublisherAware, Lifecycle, Phased, SmartLifecycle, ExpressionCapable, MessageProducer, IntegrationPattern, ClientManager.ConnectCallback, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, ManageableSmartLifecycle, TrackableComponent
Direct Known Subclasses:
MqttPahoMessageDrivenChannelAdapter, Mqttv5PahoMessageDrivenChannelAdapter

@ManagedResource @IntegrationManagedResource public abstract class AbstractMqttMessageDrivenChannelAdapter<T,C> extends MessageProducerSupport implements ApplicationEventPublisherAware, ClientManager.ConnectCallback
Abstract class for MQTT Message-Driven Channel Adapters.
Since:
4.0
Author:
Gary Russell, Artem Bilan, Trung Pham, Mikhail Polivakha, Artem Vozhdayenko
  • Field Details

    • topicLock

      protected final Lock topicLock
  • Constructor Details

    • AbstractMqttMessageDrivenChannelAdapter

      public AbstractMqttMessageDrivenChannelAdapter(@Nullable String url, String clientId, String... topic)
    • AbstractMqttMessageDrivenChannelAdapter

      public AbstractMqttMessageDrivenChannelAdapter(ClientManager<T,C> clientManager, String... topic)
  • Method Details

    • setConverter

      public void setConverter(MqttMessageConverter converter)
    • getClientManager

      @Nullable protected ClientManager<T,C> getClientManager()
    • setQos

      public void setQos(int... qos)
      Set the QoS for each topic; a single value will apply to all topics otherwise the correct number of qos values must be provided.
      Parameters:
      qos - The qos value(s).
      Since:
      4.1
    • getQos

      @ManagedAttribute public int[] getQos()
    • getUrl

      @Nullable protected String getUrl()
    • getClientId

      @Nullable protected String getClientId()
    • getConverter

      protected MqttMessageConverter getConverter()
    • getTopic

      @ManagedAttribute public String[] getTopic()
    • setDisconnectCompletionTimeout

      public void setDisconnectCompletionTimeout(long completionTimeout)
      Set the completion timeout when disconnecting. Default 5000L milliseconds.
      Parameters:
      completionTimeout - The timeout.
      Since:
      5.1.10
    • getDisconnectCompletionTimeout

      protected long getDisconnectCompletionTimeout()
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class MessageProducerSupport
    • destroy

      public void destroy()
      Specified by:
      destroy in interface DisposableBean
      Specified by:
      destroy in interface IntegrationManagement
      Overrides:
      destroy in class AbstractEndpoint
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class IntegrationObjectSupport
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface ApplicationEventPublisherAware
    • getApplicationEventPublisher

      protected ApplicationEventPublisher getApplicationEventPublisher()
    • setManualAcks

      public void setManualAcks(boolean manualAcks)
      Set the acknowledgment mode to manual.
      Parameters:
      manualAcks - true for manual acks.
      Since:
      5.3
    • isManualAcks

      protected boolean isManualAcks()
    • setCompletionTimeout

      public void setCompletionTimeout(long completionTimeout)
      Set the completion timeout for operations. Default 30000L milliseconds.
      Parameters:
      completionTimeout - The timeout.
      Since:
      4.1
    • getCompletionTimeout

      protected long getCompletionTimeout()
    • addTopic

      @ManagedOperation public void addTopic(String topic, int qos)
      Add a topic to the subscribed list.
      Parameters:
      topic - The topic.
      qos - The qos.
      Throws:
      MessagingException - if the topic is already in the list.
      Since:
      4.1
    • addTopic

      @ManagedOperation public void addTopic(String... topic)
      Add a topic (or topics) to the subscribed list (qos=1).
      Parameters:
      topic - The topics.
      Throws:
      MessagingException - if the topic is already in the list.
      Since:
      4.1
    • addTopics

      @ManagedOperation public void addTopics(String[] topic, int[] qos)
      Add topics to the subscribed list.
      Parameters:
      topic - The topics.
      qos - The qos for each topic.
      Throws:
      MessagingException - if a topic is already in the list.
      Since:
      4.1
    • removeTopic

      @ManagedOperation public void removeTopic(String... topic)
      Remove a topic (or topics) from the subscribed list.
      Parameters:
      topic - The topic.
      Throws:
      MessagingException - if the topic is not in the list.
      Since:
      4.1