Interface Mqtt5Publish
- All Superinterfaces:
Mqtt5Message
- All Known Subinterfaces:
Mqtt5WillPublish
MQTT 5 Publish message. This message is translated from and to an MQTT 5 PUBLISH packet.
- Since:
- 1.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAcknowledges this Publish message.asWill()Transforms this Publish message into a Will Publish with the same properties.static @NotNull Mqtt5PublishBuilderbuilder()Creates a builder for a Publish message.extend()Creates a builder for extending this Publish message.byte @NotNull []getQos()getTopic()default @NotNull Mqtt5MessageTypegetType()booleanisRetain()
-
Field Details
-
DEFAULT_QOS
DefaultQoSlevel of a Publish message. It is chosen asMqttQos.AT_MOST_ONCEas the QoS level should be explicitly specified if special delivery guarantees are needed.
-
-
Method Details
-
builder
Creates a builder for a Publish message.- Returns:
- the created builder.
-
getTopic
- Returns:
- the topic of this Publish message.
-
getPayload
- Returns:
- the optional payload of this Publish message.
-
getPayloadAsBytes
byte @NotNull [] getPayloadAsBytes()- Returns:
- the payload of this Publish message as a byte array. Empty byte array if the payload is not present.
-
getQos
- Returns:
- the QoS of this Publish message.
-
isRetain
boolean isRetain()- Returns:
- whether this Publish message is a retained message.
-
getMessageExpiryInterval
- Returns:
- the optional message expiry interval in seconds of this Publish message.
-
getPayloadFormatIndicator
- Returns:
- the optional payload format indicator of this Publish message.
-
getContentType
- Returns:
- the optional content type of this Publish message.
-
getResponseTopic
- Returns:
- the optional response topic of this Publish message.
-
getCorrelationData
- Returns:
- the optional correlation data of this Publish message.
-
getUserProperties
- Returns:
- the optional user properties of this Publish message.
-
acknowledge
void acknowledge()Acknowledges this Publish message.- Throws:
UnsupportedOperationException- if manual acknowledgement is not enabled.IllegalStateException- if the message is acknowledged more than once.- Since:
- 1.2
-
getType
- Specified by:
getTypein interfaceMqtt5Message- Returns:
- the type of this MQTT message.
-
asWill
Transforms this Publish message into a Will Publish with the same properties.- Returns:
- the Will Publish.
-
extend
@NotNull Mqtt5PublishBuilder.Complete extend()Creates a builder for extending this Publish message.- Returns:
- the created builder.
-