org.apache.storm.mqtt.common

## Class MqttOptions

- java.lang.Object
- - org.apache.storm.mqtt.common.MqttOptions

- All Implemented Interfaces:
    Serializable

      public class MqttOptions
      extends Object
      implements Serializable

  MQTT Configuration Options.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MqttOptions.Builder`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MqttOptions()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getConnectAttemptsMax()`
    `String` | `getPassword()`
    `int` | `getQos()`
    `long` | `getReconnectAttemptsMax()`
    `double` | `getReconnectBackOffMultiplier()`
    `long` | `getReconnectDelay()`
    `long` | `getReconnectDelayMax()`
    `List<String>` | `getTopics()`
    `String` | `getUrl()`
    `String` | `getUserName()`
    `String` | `getWillPayload()`
    `int` | `getWillQos()`
    `boolean` | `getWillRetain()`
    `String` | `getWillTopic()`
    `boolean` | `isCleanConnection()`
    `void` | `setCleanConnection(boolean cleanConnection)` Set to false if you want the MQTT server to persist topic subscriptions and ack positions across client sessions.
    `void` | `setConnectAttemptsMax(long connectAttemptsMax)` The maximum number of reconnect attempts before an error is reported back to the client on the first attempt by the client to connect to a server.
    `void` | `setPassword(String password)` The password for authenticated sessions.
    `void` | `setQos(int qos)` Sets the quality of service to use for MQTT messages.
    `void` | `setReconnectAttemptsMax(long reconnectAttemptsMax)` The maximum number of reconnect attempts before an error is reported back to the client after a server connection had previously been established.
    `void` | `setReconnectBackOffMultiplier(double reconnectBackOffMultiplier)` The Exponential backoff be used between reconnect attempts.
    `void` | `setReconnectDelay(long reconnectDelay)` How long to wait in ms before the first reconnect attempt.
    `void` | `setReconnectDelayMax(long reconnectDelayMax)` The maximum amount of time in ms to wait between reconnect attempts.
    `void` | `setTopics(List<String> topics)` A list of MQTT topics to subscribe to.
    `void` | `setUrl(String url)` Sets the url for connecting to the MQTT broker, e.g.
    `void` | `setUserName(String userName)` The username for authenticated sessions.
    `void` | `setWillPayload(String willPayload)` The Will message to send.
    `void` | `setWillQos(int qos)` Sets the quality of service to use for the MQTT Will message.
    `void` | `setWillRetain(boolean retain)` Set to true if you want the Will message to be published with the retain option.
    `void` | `setWillTopic(String willTopic)` If set the server will publish the client’s Will message to the specified topics if the client has an unexpected disconnection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MqttOptions

          public MqttOptions()

  - ### Method Detail

    - #### getUrl

          public String getUrl()

    - #### setUrl

          public void setUrl(String url)

      Sets the url for connecting to the MQTT broker, e.g. `tcp://localhost:1883`.

    - #### getTopics

          public List<String> getTopics()

    - #### setTopics

          public void setTopics(List<String> topics)

      A list of MQTT topics to subscribe to.

    - #### isCleanConnection

          public boolean isCleanConnection()

    - #### setCleanConnection

          public void setCleanConnection(boolean cleanConnection)

      Set to false if you want the MQTT server to persist topic subscriptions and ack positions across client sessions. Defaults to false.

    - #### getWillTopic

          public String getWillTopic()

    - #### setWillTopic

          public void setWillTopic(String willTopic)

      If set the server will publish the client’s Will message to the specified topics if the client has an unexpected disconnection.

    - #### getWillPayload

          public String getWillPayload()

    - #### setWillPayload

          public void setWillPayload(String willPayload)

      The Will message to send. Defaults to a zero length message.

    - #### getReconnectDelay

          public long getReconnectDelay()

    - #### setReconnectDelay

          public void setReconnectDelay(long reconnectDelay)

      How long to wait in ms before the first reconnect attempt. Defaults to 10.

    - #### getReconnectDelayMax

          public long getReconnectDelayMax()

    - #### setReconnectDelayMax

          public void setReconnectDelayMax(long reconnectDelayMax)

      The maximum amount of time in ms to wait between reconnect attempts. Defaults to 30,000.

    - #### getReconnectBackOffMultiplier

          public double getReconnectBackOffMultiplier()

    - #### setReconnectBackOffMultiplier

          public void setReconnectBackOffMultiplier(double reconnectBackOffMultiplier)

      The Exponential backoff be used between reconnect attempts. Set to 1 to disable exponential backoff. Defaults to 2.

    - #### getReconnectAttemptsMax

          public long getReconnectAttemptsMax()

    - #### setReconnectAttemptsMax

          public void setReconnectAttemptsMax(long reconnectAttemptsMax)

      The maximum number of reconnect attempts before an error is reported back to the client after a server connection had previously been established. Set to -1 to use unlimited attempts. Defaults to -1.

    - #### getConnectAttemptsMax

          public long getConnectAttemptsMax()

    - #### setConnectAttemptsMax

          public void setConnectAttemptsMax(long connectAttemptsMax)

      The maximum number of reconnect attempts before an error is reported back to the client on the first attempt by the client to connect to a server. Set to -1 to use unlimited attempts. Defaults to -1.

    - #### getUserName

          public String getUserName()

    - #### setUserName

          public void setUserName(String userName)

      The username for authenticated sessions.

    - #### getPassword

          public String getPassword()

    - #### setPassword

          public void setPassword(String password)

      The password for authenticated sessions.

    - #### getQos

          public int getQos()

    - #### setQos

          public void setQos(int qos)

      Sets the quality of service to use for MQTT messages. Defaults to 1 (at least once).

    - #### getWillQos

          public int getWillQos()

    - #### setWillQos

          public void setWillQos(int qos)

      Sets the quality of service to use for the MQTT Will message. Defaults to 1 (at least once).

    - #### getWillRetain

          public boolean getWillRetain()

    - #### setWillRetain

          public void setWillRetain(boolean retain)

      Set to true if you want the Will message to be published with the retain option.

Copyright © 2021 The Apache Software Foundation. All rights reserved.