Package software.amazon.awssdk.crt.mqtt5
Class PublishReturn
java.lang.Object
software.amazon.awssdk.crt.mqtt5.PublishReturn
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 the
get functions.
For example, getPublishPacket will return the PublishPacket received from the server.-
Method Summary
Modifier and TypeMethodDescriptionAcquires manual control over the publish acknowledgement for this PUBLISH message, preventing the client from automatically sending an acknowledgement.Returns the PublishPacket returned from the server or Null if none was returned.
-
Method Details
-
getPublishPacket
Returns the PublishPacket returned from the server or Null if none was returned.- Returns:
- The PublishPacket returned from the server.
-
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.
-