Class PublishPacket
java.lang.Object
software.amazon.awssdk.crt.mqtt5.packets.PublishPacket
Data model of an MQTT5 PUBLISH packet
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumOptional property describing a PublishPacket payload's format.static final classA class to that allows for the creation of a PublishPacket. -
Method Summary
Modifier and TypeMethodDescriptionReturns a property specifying the content type of the payload.byte[]Returns a opaque binary data used to correlate between publish messages, as a potential method for request-response implementation.Sent publishes - Returns the maximum amount of time allowed to elapse for message delivery before the server should instead delete the message (relative to a recipient).byte[]Returns the payload of the publish message.Returns the property specifying the format of the payload data.getQOS()Sent publishes - Returns the MQTT quality of service level this message should be delivered with.Returns a opaque topic string intended to assist with request/response implementations.Returns true if this is a retained message, false otherwise.Sent publishes - Ignored Received publishes - Returns the subscription identifiers of all the subscriptions this message matched.getTopic()Sent publishes - Returns the topic this message should be published to.Sent publishes - topic alias to use, if possible, when encoding this packet.Returns a list of MQTT5 user properties included with the packet.static PublishPacketCreates aPublishPacketcontaining only the most common fields: topic, QoS, and payload.
-
Method Details
-
getPayload
public byte[] getPayload()Returns the payload of the publish message. See MQTT5 Publish Payload- Returns:
- The payload of the publish message.
-
getQOS
Sent publishes - Returns the MQTT quality of service level this message should be delivered with. Received publishes - Returns the MQTT quality of service level this message was delivered at. See MQTT5 QoS- Returns:
- The MQTT quality of service associated with this PUBLISH packet.
-
getRetain
Returns true if this is a retained message, false otherwise. Always set on received publishes; on sent publishes, null implies false. See MQTT5 Retain- Returns:
- True if this is a retained message, false otherwise.
-
getTopic
Sent publishes - Returns the topic this message should be published to. Received publishes - Returns the topic this message was published to. See MQTT5 Topic Name- Returns:
- The topic associated with this PUBLISH packet.
-
getPayloadFormat
Returns the property specifying the format of the payload data. The Mqtt5Client does not enforce or use this value in a meaningful way. See MQTT5 Payload Format Indicator- Returns:
- Property specifying the format of the payload data.
-
getMessageExpiryIntervalSeconds
Sent publishes - Returns the maximum amount of time allowed to elapse for message delivery before the server should instead delete the message (relative to a recipient). Received publishes - Returns the remaining amount of time (from the server's perspective) before the message would have been deleted relative to the subscribing client. If left null, indicates no expiration timeout. See MQTT5 Message Expiry Interval- Returns:
- The message expiry interval associated with this PublishPacket.
-
getTopicAlias
Sent publishes - topic alias to use, if possible, when encoding this packet. Only used if the client's outbound topic aliasing mode is set to Manual. Received publishes - topic alias used by the server when transmitting the publish to the client. See MQTT5 Topic Alias- Returns:
- The topic alias associated with this PublishPacket.
-
getResponseTopic
Returns a opaque topic string intended to assist with request/response implementations. Not internally meaningful to MQTT5 or this client. See MQTT5 Response Topic- Returns:
- Opaque topic string intended to assist with request/response implementations.
-
getCorrelationData
public byte[] getCorrelationData()Returns a opaque binary data used to correlate between publish messages, as a potential method for request-response implementation. Not internally meaningful to MQTT5. See MQTT5 Correlation Data- Returns:
- Opaque binary data used to correlate between publish messages.
-
getContentType
Returns a property specifying the content type of the payload. Not internally meaningful to MQTT5. See MQTT5 Content Type- Returns:
- Property specifying the content type of the payload.
-
getUserProperties
Returns a list of MQTT5 user properties included with the packet. See MQTT5 User Property- Returns:
- List of MQTT5 user properties included with the packet.
-
getSubscriptionIdentifiers
Sent publishes - Ignored Received publishes - Returns the subscription identifiers of all the subscriptions this message matched. See MQTT5 Subscription Identifier- Returns:
- the subscription identifiers of all the subscriptions this message matched.
-
of
Creates aPublishPacketcontaining only the most common fields: topic, QoS, and payload.Internally this is just syntactic sugar around
PublishPacketBuilder(String, QOS, byte[])followed byPublishPacket.PublishPacketBuilder.build(). All optional MQTT 5 properties (retain flag, user properties, etc.) are leftnull/ unset.- Parameters:
topic- The topic this message should be published to.qos- The MQTT quality of service level the message should be delivered with.payload- The payload for the publish message.- Returns:
- an immutable
PublishPacketready for use - Throws:
NullPointerException- iftopic,qos, orpayloadisnull
-