Class DisconnectPacket.DisconnectPacketBuilder
- java.lang.Object
-
- software.amazon.awssdk.crt.mqtt5.packets.DisconnectPacket.DisconnectPacketBuilder
-
- Enclosing class:
- DisconnectPacket
public static final class DisconnectPacket.DisconnectPacketBuilder extends Object
A class to that allows for the creation of a DisconnectPacket. Set all of the settings you want in the packet and then use the build() function to get a DisconnectPacket populated with the settings defined in the builder.
-
-
Constructor Summary
Constructors Constructor Description DisconnectPacketBuilder()
Creates a new DisconnectPacketBuilder so a DisconnectPacket can be created.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DisconnectPacket
build()
Creates a new DisconnectPacket using the settings set in the builder.DisconnectPacket.DisconnectPacketBuilder
withReasonCode(DisconnectPacket.DisconnectReasonCode reasonCode)
Sets the value indicating the reason that the sender is closing the connection See MQTT5 Disconnect Reason CodeDisconnectPacket.DisconnectPacketBuilder
withReasonString(String reasonString)
Sets the additional diagnostic information about the reason that the sender is closing the connection See MQTT5 Reason StringDisconnectPacket.DisconnectPacketBuilder
withServerReference(String serverReference)
Sets the property indicating an alternate server that the client may temporarily or permanently attempt to connect to instead of the configured endpoint.DisconnectPacket.DisconnectPacketBuilder
withSessionExpiryIntervalSeconds(long sessionExpiryIntervalSeconds)
Sets the change to the session expiry interval negotiated at connection time as part of the disconnect.DisconnectPacket.DisconnectPacketBuilder
withUserProperties(List<UserProperty> userProperties)
Sets the list of MQTT5 user properties included with the packet.
-
-
-
Method Detail
-
withReasonCode
public DisconnectPacket.DisconnectPacketBuilder withReasonCode(DisconnectPacket.DisconnectReasonCode reasonCode)
Sets the value indicating the reason that the sender is closing the connection See MQTT5 Disconnect Reason Code- Parameters:
reasonCode
- Value indicating the reason that the sender is closing the connection- Returns:
- The DisconnectPacketBuilder after setting the reason code.
-
withSessionExpiryIntervalSeconds
public DisconnectPacket.DisconnectPacketBuilder withSessionExpiryIntervalSeconds(long sessionExpiryIntervalSeconds)
Sets the change to the session expiry interval negotiated at connection time as part of the disconnect. Only valid for DisconnectPackets sent from client to server. It is not valid to attempt to change session expiry from zero to a non-zero value. See MQTT5 Session Expiry Interval- Parameters:
sessionExpiryIntervalSeconds
- the session expiry interval negotiated at connection time as part of the disconnect- Returns:
- The DisconnectPacketBuilder after setting the session expiry interval.
-
withReasonString
public DisconnectPacket.DisconnectPacketBuilder withReasonString(String reasonString)
Sets the additional diagnostic information about the reason that the sender is closing the connection See MQTT5 Reason String- Parameters:
reasonString
- Additional diagnostic information about the reason that the sender is closing the connection- Returns:
- The DisconnectPacketBuilder after setting the reason string.
-
withUserProperties
public DisconnectPacket.DisconnectPacketBuilder withUserProperties(List<UserProperty> userProperties)
Sets the list of MQTT5 user properties included with the packet. See MQTT5 User Property- Parameters:
userProperties
- List of MQTT5 user properties included with the packet.- Returns:
- The DisconnectPacketBuilder after setting the user properties.
-
withServerReference
public DisconnectPacket.DisconnectPacketBuilder withServerReference(String serverReference)
Sets the property indicating an alternate server that the client may temporarily or permanently attempt to connect to instead of the configured endpoint. Will only be set if the reason code indicates another server may be used (ServerMoved, UseAnotherServer). See MQTT5 Server Reference- Parameters:
serverReference
- Property indicating an alternate server that the client may temporarily or permanently attempt to connect to instead of the configured endpoint.- Returns:
- The DisconnectPacketBuilder after setting the server reference.
-
build
public DisconnectPacket build()
Creates a new DisconnectPacket using the settings set in the builder.- Returns:
- The DisconnectPacket created from the builder
-
-