Class MqttException

    • Field Detail

      • REASON_CODE_CLIENT_EXCEPTION

        public static final int REASON_CODE_CLIENT_EXCEPTION
        Client encountered an exception. Use the Throwable.getCause() method to get the underlying reason.
        See Also:
        Constant Field Values
      • REASON_CODE_SUBSCRIBE_FAILED

        public static final int REASON_CODE_SUBSCRIBE_FAILED
        Error from subscribe - returned from the server.
        See Also:
        Constant Field Values
      • REASON_CODE_CLIENT_TIMEOUT

        public static final int REASON_CODE_CLIENT_TIMEOUT
        Client timed out while waiting for a response from the server. The server is no longer responding to keep-alive messages.
        See Also:
        Constant Field Values
      • REASON_CODE_CLIENT_CONNECTED

        public static final int REASON_CODE_CLIENT_CONNECTED
        The client is already connected.
        See Also:
        Constant Field Values
      • REASON_CODE_CLIENT_ALREADY_DISCONNECTED

        public static final short REASON_CODE_CLIENT_ALREADY_DISCONNECTED
        The client is already disconnected.
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_CONNECT_ERROR

        public static final int REASON_CODE_SERVER_CONNECT_ERROR
        Unable to connect to server.
        See Also:
        Constant Field Values
      • REASON_CODE_INVALID_MESSAGE

        public static final int REASON_CODE_INVALID_MESSAGE
        Protocol error: the message was not recognized as a valid MQTT packet. Possible reasons for this include connecting to a non-MQTT server, or connecting to an SSL server port when the client isn't using SSL.
        See Also:
        Constant Field Values
      • REASON_CODE_CONNECTION_LOST

        public static final int REASON_CODE_CONNECTION_LOST
        The client has been unexpectedly disconnected from the server. The cause will provide more details.
        See Also:
        Constant Field Values
      • REASON_CODE_CLIENT_CLOSED

        public static final int REASON_CODE_CLIENT_CLOSED
        The client is closed - no operations are permitted on the client in this state. New up a new client to continue.
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_MESSAGE_LENGTH_OVERFLOW

        public static final int REASON_CODE_SERVER_MESSAGE_LENGTH_OVERFLOW
        Server inconsistency (message length integer overflow).
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_EXPECTED_CLEAN_SESSION

        public static final int REASON_CODE_SERVER_EXPECTED_CLEAN_SESSION
        Server inconsistency (clean session not accepted).
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_UNEXPECTED_ACK_MESSAGE

        public static final int REASON_CODE_SERVER_UNEXPECTED_ACK_MESSAGE
        Server inconsistency (received message acknowledgment to unexpected action).
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_UNEXPECTED_ACK_PACKET_IDENTIFIER

        public static final int REASON_CODE_SERVER_UNEXPECTED_ACK_PACKET_IDENTIFIER
        Server inconsistency (received message acknowledgment to unexpected packet identifier).
        See Also:
        Constant Field Values
      • REASON_CODE_SERVER_UNEXPECTED_PINGRESP_MESSAGE

        public static final int REASON_CODE_SERVER_UNEXPECTED_PINGRESP_MESSAGE
        Server inconsistency (received unexpected ping response packet).
        See Also:
        Constant Field Values
    • Constructor Detail

      • MqttException

        public MqttException​(int reasonCode)
        Constructs a new MqttException with the specified code as the underlying reason.
        Parameters:
        reasonCode - the reason code for the exception.
      • MqttException

        public MqttException​(Throwable cause)
        Constructs a new MqttException with the specified Throwable as the underlying reason.
        Parameters:
        cause - the underlying cause of the exception.
      • MqttException

        public MqttException​(int reason,
                             Throwable cause)
        Constructs a new MqttException with the specified Throwable as the underlying reason.
        Parameters:
        reason - the reason code for the exception.
        cause - the underlying cause of the exception.
    • Method Detail

      • getReasonCode

        public int getReasonCode()
        Returns the reason code for this exception.
        Returns:
        the code representing the reason for this exception.
      • getMessage

        @NonNull
        public String getMessage()
        Returns the detail message for this exception.
        Overrides:
        getMessage in class Throwable
        Returns:
        the detail message, which may be null.