Interface ModifiableUnsubackPacket
-
- All Superinterfaces:
UnsubackPacket
@DoNotImplement public interface ModifiableUnsubackPacket extends UnsubackPacket
AnUnsubackPacket
that can be modified before it is sent to the client.For MQTT 3 clients you should skip modifying this packet, as the changeable properties exists only since MQTT 5 and will therefore not be send to the MQTT 3 client.
- Since:
- 4.3.0, CE 2020.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ModifiableUserProperties
getUserProperties()
Gets the modifiableUserProperties
of the UNSUBACK packet.void
setReasonCodes(@NotNull List<@NotNull UnsubackReasonCode> reasonCodes)
Sets a list ofUnsubackReasonCode
s for the UNSUBACK packet.void
setReasonString(@Nullable String reasonString)
Sets the reason string for the UNSUBACK packet.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.unsuback.UnsubackPacket
getPacketIdentifier, getReasonCodes, getReasonString
-
-
-
-
Method Detail
-
setReasonCodes
void setReasonCodes(@NotNull List<@NotNull UnsubackReasonCode> reasonCodes)
Sets a list ofUnsubackReasonCode
s for the UNSUBACK packet.This setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the UNSUBACK is sent to the client (as MQTT 3.x clients don't know this property).
- Parameters:
reasonCodes
- The list of reason codes to be written into the UNSUBACK packet.- Throws:
NullPointerException
- If the list of reason codes or one of its elements isnull
.IllegalArgumentException
- If the amount of reason codes passed differs from that contained in the packet being manipulated.IllegalStateException
- If switching from successful reason code to unsuccessful reason code or vice versa. Check outUnsubackReasonCode
to see what reason code counts as a success or unsuccessful code.- Since:
- 4.3.0, CE 2020.1
-
setReasonString
void setReasonString(@Nullable String reasonString)
Sets the reason string for the UNSUBACK packet.This setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the UNSUBACK is sent to the client (as MQTT 3.x clients don't know this property).
- Parameters:
reasonString
- The reason to be set as a 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
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
Gets the modifiableUserProperties
of the UNSUBACK packet.This setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the UNSUBACK is sent to the client (as MQTT 3.x clients don't know this property).
- Specified by:
getUserProperties
in interfaceUnsubackPacket
- Returns:
- Modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-
-