Interface ClientManager<T,C>

Type Parameters:
T - MQTT client type
C - MQTT connection options type (v5 or v3)
All Superinterfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.Lifecycle, MqttComponent<C>, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
All Known Implementing Classes:
AbstractMqttClientManager, Mqttv3ClientManager, Mqttv5ClientManager

public interface ClientManager<T,C> extends org.springframework.context.SmartLifecycle, MqttComponent<C>
A utility abstraction over MQTT client which can be used in any MQTT-related component without need to handle generic client callbacks, reconnects etc. Using this manager in multiple MQTT integrations will preserve a single connection.
Since:
6.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A contract for a custom callback on connectComplete event from the client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    The default completion timeout in milliseconds.
    static final long
    The default disconnect completion timeout in milliseconds.

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Register a callback for the connectComplete event from the client.
    Return the managed client.
    boolean
    Return the managed clients isConnected.
    boolean
    If manual acknowledge has to be used; false by default.
    boolean
    Remove the callback from registration.

    Methods inherited from interface org.springframework.beans.factory.BeanNameAware

    setBeanName

    Methods inherited from interface org.springframework.context.Lifecycle

    isRunning, start, stop

    Methods inherited from interface org.springframework.integration.mqtt.core.MqttComponent

    getBeanName, getConnectionInfo

    Methods inherited from interface org.springframework.context.SmartLifecycle

    getPhase, isAutoStartup, stop
  • Field Details

    • DEFAULT_COMPLETION_TIMEOUT

      static final long DEFAULT_COMPLETION_TIMEOUT
      The default completion timeout in milliseconds.
      See Also:
    • DISCONNECT_COMPLETION_TIMEOUT

      static final long DISCONNECT_COMPLETION_TIMEOUT
      The default disconnect completion timeout in milliseconds.
      See Also:
  • Method Details

    • getClient

      T getClient()
      Return the managed client.
      Returns:
      the managed client.
    • isManualAcks

      boolean isManualAcks()
      If manual acknowledge has to be used; false by default.
      Returns:
      true if manual acknowledge has to be used.
    • addCallback

      void addCallback(ClientManager.ConnectCallback connectCallback)
      Register a callback for the connectComplete event from the client.
      Parameters:
      connectCallback - a ClientManager.ConnectCallback to register.
    • removeCallback

      boolean removeCallback(ClientManager.ConnectCallback connectCallback)
      Remove the callback from registration.
      Parameters:
      connectCallback - a ClientManager.ConnectCallback to unregister.
      Returns:
      true if callback was removed.
    • isConnected

      boolean isConnected()
      Return the managed clients isConnected.
      Returns:
      the managed clients isConnected.
      Since:
      6.4