Interface ModifiableUnsubackPacket

All Superinterfaces:
UnsubackPacket

@DoNotImplement
public interface ModifiableUnsubackPacket
extends UnsubackPacket
An UnsubackPacket 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 Details

    • setReasonCodes

      void setReasonCodes​(@NotNull List<@NotNull UnsubackReasonCode> reasonCodes)
      Sets a list of UnsubackReasonCodes 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 is null.
      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 out UnsubackReasonCode 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

      Gets the modifiable UserProperties 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 interface UnsubackPacket
      Returns:
      Modifiable user properties.
      Since:
      4.3.0, CE 2020.1