Interface ModifiableSubackPacket
-
- All Superinterfaces:
SubackPacket
@DoNotImplement public interface ModifiableSubackPacket extends SubackPacket
ASubackPacket
that can be modified before it is sent to the client.For MQTT 3 clients you should only modify the reason codes, as the other properties exists only since MQTT 5 and will therefore not be send to an 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()
The modifiableUserProperties
of the SUBACK packet.void
setReasonCodes(@NotNull List<@NotNull SubackReasonCode> reasonCodes)
Sets the list ofreason codes
of the SUBACK packet.void
setReasonString(@Nullable String reasonString)
Sets the reason string of the SUBACK packet.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.suback.SubackPacket
getPacketIdentifier, getReasonCodes, getReasonString
-
-
-
-
Method Detail
-
setReasonCodes
void setReasonCodes(@NotNull List<@NotNull SubackReasonCode> reasonCodes)
Sets the list ofreason codes
of the SUBACK packet.MQTT 3.x clients know less SUBACK reason codes than MQTT 5 clients. See
SubackReasonCode
how HiveMQ will transform the unknown reason codes for MQTT 3.x clients.- Parameters:
reasonCodes
- The list of reason codes to be written into the SUBACK packet.- Throws:
NullPointerException
- If the list or an individual reason code 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 outSubackReasonCode
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 of the SUBACK packet.This setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the SUBACK is sent to the client (as MQTT 3.x clients don't know this property).
- Parameters:
reasonString
- The reason string ornull
to 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
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
The modifiableUserProperties
of the SUBACK packet.This setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the SUBACK is sent to the client (as MQTT 3.x clients don't know this property).
- Specified by:
getUserProperties
in interfaceSubackPacket
- Returns:
- Modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-
-