Enum Class MqttClientState

java.lang.Object
java.lang.Enum<MqttClientState>
com.hivemq.client.mqtt.MqttClientState
All Implemented Interfaces:
Serializable, Comparable<MqttClientState>, Constable

public enum MqttClientState extends Enum<MqttClientState>
State of an MqttClient.
 +--------------+             +------------------------+
 | DISCONNECTED <-+         +-> DISCONNECTED_RECONNECT |
 +-------+------+  \       /  +-----------+------------+
         |          \     /               |
         |           \   /                |
 +-------v------+     \ /     +-----------v------------+
 |  CONNECTING  +------x------+  CONNECTING_RECONNECT  |
 +-------+------+      |      +-----------+------------+
         |             |                  |
         |             |                  |
         |      +------+------+           |
         +------>  CONNECTED  <-----------+
                +-------------+
 
Since:
1.0
  • Enum Constant Details

    • DISCONNECTED

      public static final MqttClientState DISCONNECTED
      The client is disconnected.
    • CONNECTING

      public static final MqttClientState CONNECTING
      The client is connecting.

      This means the client was DISCONNECTED, a Connect message is sent, but the ConnAck message is not received yet.

    • CONNECTED

      public static final MqttClientState CONNECTED
      The client is connected.
    • DISCONNECTED_RECONNECT

      public static final MqttClientState DISCONNECTED_RECONNECT
      The client is disconnected but will reconnect.
    • CONNECTING_RECONNECT

      public static final MqttClientState CONNECTING_RECONNECT
      The client is reconnecting.

      This means the client was DISCONNECTED_RECONNECT, a Connect message is sent, but the ConnAck message is not received yet.

  • Method Details

    • values

      public static MqttClientState[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MqttClientState valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isConnected

      public boolean isConnected()
      Returns:
      whether the client is connected.
    • isConnectedOrReconnect

      public boolean isConnectedOrReconnect()
      Returns:
      whether the client is connected or will reconnect.