Interface ModifiablePubackPacket
- All Superinterfaces:
PubackPacket
@DoNotImplement public interface ModifiablePubackPacket extends PubackPacket
PubackPacket that can be modified before it is sent to the client (for PubackOutboundInterceptor)
or to the server (for PubackInboundInterceptor).- Since:
- 4.3.0, CE 2020.1
-
Method Summary
Modifier and Type Method Description @NotNull ModifiableUserPropertiesgetUserProperties()Get the modifiableUserPropertiesof the PUBACK packet.voidsetReasonCode(@NotNull AckReasonCode reasonCode)Set aAckReasonCodeto the PUBACK packet.voidsetReasonString(@Nullable String reasonString)Set the reason string.Methods inherited from interface com.hivemq.extension.sdk.api.packets.puback.PubackPacket
getPacketIdentifier, getReasonCode, getReasonString
-
Method Details
-
setReasonCode
Set aAckReasonCodeto the PUBACK packet.Switching from successful to unsuccessful and vice versa is not supported, in that case an
IllegalStateExceptionis thrown.- Parameters:
reasonCode- The reason code to set.- Throws:
NullPointerException- If reason code isnull.IllegalStateException- If switching from successful reason code to unsuccessful reason code or vice versa.- Since:
- 4.3.0, CE 2020.1
- See Also:
How reason codes are translated from MQTT 5 to MQTT 3.
-
setReasonString
Set the reason string.A reason must not be set for a successful publish.
For an
PubackOutboundInterceptorthis setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the PUBACK is sent to the client (as MQTT 3.x clients don't know this property).For an
PubackInboundInterceptorthis setting is respected for MQTT 5 and MQTT 3.x clients when the PUBACK is sent to HiveMQ, this allows to enrich MQTT 3.x PUBACKs with this MQTT 5 property.- Parameters:
reasonString- The reason string to set.- 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
Get the modifiableUserPropertiesof the PUBACK packet.For an
PubackOutboundInterceptorthis setting is only respected for MQTT 5 clients and ignored for MQTT 3.x clients when the PUBACK is sent to the client (as MQTT 3.x clients don't know this property).For an
PubackInboundInterceptorthis setting is respected for MQTT 5 and MQTT 3.x clients when the PUBACK is sent to HiveMQ, this allows to enrich MQTT 3.x PUBACKs with this MQTT 5 property.- Specified by:
getUserPropertiesin interfacePubackPacket- Returns:
- Modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-