Class AbstractMqttClientManager<T,C>

java.lang.Object
org.springframework.integration.mqtt.core.AbstractMqttClientManager<T,C>
Type Parameters:
T - MQTT client type
C - MQTT connection options type (v5 or v3)
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, ClientManager<T,C>, MqttComponent<C>
Direct Known Subclasses:
Mqttv3ClientManager, Mqttv5ClientManager

public abstract class AbstractMqttClientManager<T,C> extends Object implements ClientManager<T,C>, org.springframework.context.ApplicationEventPublisherAware
Abstract class for MQTT client managers which can be a base for any common v3/v5 client manager implementation. Contains some basic utility and implementation-agnostic fields and methods.
Since:
6.0
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

    • AbstractMqttClientManager

      protected AbstractMqttClientManager(String clientId)
  • Method Details

    • setManualAcks

      public void setManualAcks(boolean manualAcks)
    • getUrl

      protected String getUrl()
    • setUrl

      protected void setUrl(String url)
    • getClientId

      protected String getClientId()
    • getApplicationEventPublisher

      protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
    • setClient

      protected void setClient(T client)
    • getCallbacks

      protected Set<ClientManager.ConnectCallback> getCallbacks()
    • isManualAcks

      public boolean isManualAcks()
      Description copied from interface: ClientManager
      If manual acknowledge has to be used; false by default.
      Specified by:
      isManualAcks in interface ClientManager<T,C>
      Returns:
      true if manual acknowledge has to be used.
    • getClient

      public T getClient()
      Description copied from interface: ClientManager
      Return the managed client.
      Specified by:
      getClient in interface ClientManager<T,C>
      Returns:
      the managed client.
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • setBeanName

      public void setBeanName(String name)
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • getBeanName

      public String getBeanName()
      Description copied from interface: MqttComponent
      Return this component's bean name.
      Specified by:
      getBeanName in interface MqttComponent<T>
      Returns:
      the bean name.
    • getPhase

      public int getPhase()
      The phase of component autostart in SmartLifecycle. If the custom one is required, note that for the correct behavior it should be less than phase of AbstractMqttMessageDrivenChannelAdapter implementations. The default phase is DEFAULT_MANAGER_PHASE.
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
      Returns:
      SmartLifecycle autostart phase
      See Also:
    • addCallback

      public void addCallback(ClientManager.ConnectCallback connectCallback)
      Description copied from interface: ClientManager
      Register a callback for the connectComplete event from the client.
      Specified by:
      addCallback in interface ClientManager<T,C>
      Parameters:
      connectCallback - a ClientManager.ConnectCallback to register.
    • removeCallback

      public boolean removeCallback(ClientManager.ConnectCallback connectCallback)
      Description copied from interface: ClientManager
      Remove the callback from registration.
      Specified by:
      removeCallback in interface ClientManager<T,C>
      Parameters:
      connectCallback - a ClientManager.ConnectCallback to unregister.
      Returns:
      true if callback was removed.
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • setPhase

      public void setPhase(int phase)
      Set the phase of component autostart in SmartLifecycle. If the custom one is required, note that for the correct behavior it should be less than phase of AbstractMqttMessageDrivenChannelAdapter implementations.
      See Also: