Class DefaultMqttPahoClientFactory

java.lang.Object
org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory
All Implemented Interfaces:
MqttPahoClientFactory

public class DefaultMqttPahoClientFactory
extends java.lang.Object
implements MqttPahoClientFactory
Creates a default MqttClient and a set of options as configured.
Since:
4.0
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  DefaultMqttPahoClientFactory.Will  
  • Constructor Summary

    Constructors 
    Constructor Description
    DefaultMqttPahoClientFactory()  
  • Method Summary

    Modifier and Type Method Description
    org.eclipse.paho.client.mqttv3.IMqttAsyncClient getAsyncClientInstance​(java.lang.String uri, java.lang.String clientId)
    Retrieve an async client instance.
    org.eclipse.paho.client.mqttv3.IMqttClient getClientInstance​(java.lang.String uri, java.lang.String clientId)
    Retrieve a client instance.
    org.eclipse.paho.client.mqttv3.MqttConnectOptions getConnectionOptions()
    Retrieve the connection options.
    ConsumerStopAction getConsumerStopAction()
    Get the consumer stop action.
    void setConnectionOptions​(org.eclipse.paho.client.mqttv3.MqttConnectOptions options)
    Set the preconfigured MqttConnectOptions.
    void setConsumerStopAction​(ConsumerStopAction consumerStopAction)
    Set the consumer stop action.
    void setPersistence​(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence)
    Set the persistence to pass into the client constructor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • setPersistence

      public void setPersistence​(org.eclipse.paho.client.mqttv3.MqttClientPersistence persistence)
      Set the persistence to pass into the client constructor.
      Parameters:
      persistence - the persistence to set.
    • getConsumerStopAction

      public ConsumerStopAction getConsumerStopAction()
      Get the consumer stop action.
      Specified by:
      getConsumerStopAction in interface MqttPahoClientFactory
      Returns:
      the consumer stop action.
      Since:
      4.2.3
    • setConsumerStopAction

      public void setConsumerStopAction​(ConsumerStopAction consumerStopAction)
      Set the consumer stop action. Determines whether we unsubscribe when the consumer stops. Default: ConsumerStopAction.UNSUBSCRIBE_CLEAN.
      Parameters:
      consumerStopAction - the consumer stop action.
      Since:
      4.2.3.
    • getClientInstance

      public org.eclipse.paho.client.mqttv3.IMqttClient getClientInstance​(java.lang.String uri, java.lang.String clientId) throws org.eclipse.paho.client.mqttv3.MqttException
      Description copied from interface: MqttPahoClientFactory
      Retrieve a client instance.
      Specified by:
      getClientInstance in interface MqttPahoClientFactory
      Parameters:
      uri - The URL.
      clientId - The client id.
      Returns:
      The client instance.
      Throws:
      org.eclipse.paho.client.mqttv3.MqttException - Any.
    • getAsyncClientInstance

      public org.eclipse.paho.client.mqttv3.IMqttAsyncClient getAsyncClientInstance​(java.lang.String uri, java.lang.String clientId) throws org.eclipse.paho.client.mqttv3.MqttException
      Description copied from interface: MqttPahoClientFactory
      Retrieve an async client instance.
      Specified by:
      getAsyncClientInstance in interface MqttPahoClientFactory
      Parameters:
      uri - The URL.
      clientId - The client id.
      Returns:
      The client instance.
      Throws:
      org.eclipse.paho.client.mqttv3.MqttException - Any.
    • setConnectionOptions

      public void setConnectionOptions​(org.eclipse.paho.client.mqttv3.MqttConnectOptions options)
      Set the preconfigured MqttConnectOptions.
      Parameters:
      options - the options.
      Since:
      4.3.16
    • getConnectionOptions

      public org.eclipse.paho.client.mqttv3.MqttConnectOptions getConnectionOptions()
      Description copied from interface: MqttPahoClientFactory
      Retrieve the connection options.
      Specified by:
      getConnectionOptions in interface MqttPahoClientFactory
      Returns:
      The options.