Package com.plccom.mqtt.client
Class MqttDisconnectedContext
- java.lang.Object
-
- com.plccom.mqtt.client.MqttDisconnectedContext
-
public final class MqttDisconnectedContext extends Object
Context delivered when a high-level client connection becomes disconnected.
-
-
Constructor Summary
Constructors Constructor Description MqttDisconnectedContext(String clientId, PlccomMqttProtocolVersion negotiatedProtocolVersion, boolean graceful, Throwable cause)Creates an immutable disconnected-context value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwablecause()Returns the disconnect cause.StringclientId()Returns the MQTT Client Identifier used by the connection.booleangraceful()Returns whether the disconnect was initiated as a graceful MQTT DISCONNECT.PlccomMqttProtocolVersionnegotiatedProtocolVersion()Returns the concrete protocol version that had been negotiated.
-
-
-
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 connectionnegotiatedProtocolVersion- concrete MQTT version that had been negotiated, ornullwhen disconnect happened before negotiation completedgraceful-truewhen the client deliberately sent MQTT DISCONNECT before closing the transportcause- failure cause, ornullfor application-requested disconnect/close paths- Throws:
NullPointerException- ifclientIdisnull
-
-
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
nullwhen unavailable
-
graceful
public boolean graceful()
Returns whether the disconnect was initiated as a graceful MQTT DISCONNECT.- Returns:
truefor a deliberate MQTT DISCONNECT path
-
cause
public Throwable cause()
Returns the disconnect cause.- Returns:
- failure cause, or
nullfor deliberate disconnect/close
-
-