Interface ModifiableInboundDisconnectPacket
- All Superinterfaces:
DisconnectPacket
@DoNotImplement public interface ModifiableInboundDisconnectPacket extends DisconnectPacket
An inbound
DisconnectPacket that can be modified before it is sent to the server.- Since:
- 4.3.0, CE 2020.1
-
Method Summary
Modifier and Type Method Description @NotNull ModifiableUserPropertiesgetUserProperties()The modifiableUserPropertiesof the DISCONNECT packet.voidsetReasonCode(@NotNull DisconnectReasonCode reasonCode)Set theDisconnectReasonCodeof the DISCONNECT packet.voidsetReasonString(@Nullable String reasonString)Set the reason string of the DISCONNECT packet.voidsetSessionExpiryInterval(@Nullable Long sessionExpiryInterval)Sets the session expiry interval of the DISCONNECT packet.Methods inherited from interface com.hivemq.extension.sdk.api.packets.disconnect.DisconnectPacket
getReasonCode, getReasonString, getServerReference, getSessionExpiryInterval
-
Method Details
-
setReasonCode
Set theDisconnectReasonCodeof the DISCONNECT packet.- Parameters:
reasonCode- The reason code to set.- Throws:
NullPointerException- If reason code isnull.IllegalArgumentException- If the disconnect reason code must not be used for inbound disconnect packets from a client to the server.- Since:
- 4.3.0, CE 2020.1
- See Also:
What reason codes exist for inbound disconnect packets from a client to the server.
-
setReasonString
Set the reason string of the DISCONNECT packet.This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.
- Parameters:
reasonString- The reason string to set ornullto remove the reason string.- Throws:
IllegalArgumentException- If the reason string is not a valid UTF-8 string.IllegalArgumentException- If the reason string exceeds the UTF-8 string length limit.- Since:
- 4.3.0, CE 2020.1
-
setSessionExpiryInterval
Sets the session expiry interval of the DISCONNECT packet.- Parameters:
sessionExpiryInterval- The session expiry interval to set ornullto use the session expiry interval of the CONNECT/CONNACK handshake.- Throws:
IllegalStateException- If the session expiry interval is modified if the session expiry interval of the CONNECT packet was 0.IllegalArgumentException- If the session expiry interval is less than 0.IllegalArgumentException- If the session expiry interval is greater than the configured maximum.- Since:
- 4.3.0, CE 2020.1
-
getUserProperties
The modifiableUserPropertiesof the DISCONNECT packet.- Specified by:
getUserPropertiesin interfaceDisconnectPacket- Returns:
- The modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-