Interface MqttClientDisconnectedContext

All Known Subinterfaces:
Mqtt3ClientDisconnectedContext, Mqtt5ClientDisconnectedContext

@DoNotImplement public interface MqttClientDisconnectedContext
Provides context about the client that is now disconnected, the cause for disconnection and allows reconnecting.
Since:
1.1
  • Method Details

    • getClientConfig

      Returns:
      the config of the client that is now disconnected.
    • getSource

      Returns:
      the source which triggered the disconnection.
    • getCause

      Returns the cause for disconnection.

      This can be:

      Example: You can use the following code to extract the Disconnect message:

       TypeSwitch.when(context.getCause()).is(Mqtt5DisconnectException.class, disconnectException -> {
           Mqtt5Disconnect disconnect = disconnectException.getMqttMessage();
       }).is(Mqtt3DisconnectException.class, disconnectException -> {
           Mqtt3Disconnect disconnect = disconnectException.getMqttMessage();
       });
       
      Returns:
      the cause for disconnection.
    • getReconnector

      Returns:
      the reconnector which can be used for reconnecting.