Class MqttDisconnectedContext


  • public final class MqttDisconnectedContext
    extends Object
    Context delivered when a high-level client connection becomes disconnected.
    • Constructor Detail

      • MqttDisconnectedContext

        public MqttDisconnectedContext​(String clientId,
                                       PlccomMqttProtocolVersion negotiatedProtocolVersion,
                                       boolean graceful,
                                       Throwable cause)
        Creates an immutable disconnected-context value.
        Parameters:
        clientId - MQTT Client Identifier used by the connection
        negotiatedProtocolVersion - concrete MQTT version that had been negotiated, or null when disconnect happened before negotiation completed
        graceful - true when the client deliberately sent MQTT DISCONNECT before closing the transport
        cause - failure cause, or null for application-requested disconnect/close paths
        Throws:
        NullPointerException - if clientId is null
    • Method Detail

      • clientId

        public String clientId()
        Returns the MQTT Client Identifier used by the connection.
        Returns:
        MQTT Client Identifier
      • negotiatedProtocolVersion

        public PlccomMqttProtocolVersion negotiatedProtocolVersion()
        Returns the concrete protocol version that had been negotiated.
        Returns:
        negotiated MQTT version, or null when unavailable
      • graceful

        public boolean graceful()
        Returns whether the disconnect was initiated as a graceful MQTT DISCONNECT.
        Returns:
        true for a deliberate MQTT DISCONNECT path
      • cause

        public Throwable cause()
        Returns the disconnect cause.
        Returns:
        failure cause, or null for deliberate disconnect/close