Package software.amazon.awssdk.crt.mqtt5
Class PublishReturn
- java.lang.Object
-
- software.amazon.awssdk.crt.mqtt5.PublishReturn
-
public class PublishReturn extends Object
The data returned when a publish is made to a topic the MQTT5 client is subscribed to. The data contained within can be gotten using thegetfunctions. For example,getPublishPacketwill return the PublishPacket received from the server.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mqtt5PublishAcknowledgementControlHandleacquirePublishAcknowledgementControl()Acquires manual control over the publish acknowledgement for this PUBLISH message, preventing the client from automatically sending an acknowledgement.PublishPacketgetPublishPacket()Returns the PublishPacket returned from the server or Null if none was returned.
-
-
-
Method Detail
-
getPublishPacket
public PublishPacket getPublishPacket()
Returns the PublishPacket returned from the server or Null if none was returned.- Returns:
- The PublishPacket returned from the server.
-
acquirePublishAcknowledgementControl
public Mqtt5PublishAcknowledgementControlHandle acquirePublishAcknowledgementControl()
Acquires manual control over the publish acknowledgement for this PUBLISH message, preventing the client from automatically sending an acknowledgement. The returned handle can be passed toMqtt5Client.invokePublishAcknowledgement(Mqtt5PublishAcknowledgementControlHandle)at a later time to send the publish acknowledgement to the broker.Important: This method must be called within the
Mqtt5ClientOptions.PublishEvents.onMessageReceived(software.amazon.awssdk.crt.mqtt5.Mqtt5Client, software.amazon.awssdk.crt.mqtt5.PublishReturn)callback. Calling it outside the callback (wrong thread) or after it has already been called will returnnull.This method may only be called once per received PUBLISH. Subsequent calls will return
null.If this method is not called, the client will automatically send a publish acknowledgment for QoS 1 messages when the callback returns.
- Returns:
- A
Mqtt5PublishAcknowledgementControlHandlethat can be used to manually send the acknowledgement, ornullif called outside the callback, called more than once, or called on a QoS 0 message.
-
-