Interface PublishPacket
-
- All Known Subinterfaces:
ModifiableOutboundPublish,ModifiablePublishPacket,ModifiableWillPublish,WillPublishPacket
@Immutable @DoNotImplement public interface PublishPacket
Represents a PUBLISH packet.Contains all values of an MQTT 5 PUBLISH, but will also used to represent MQTT 3 publishes.
- Since:
- 4.0.0, CE 2019.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Optional<String>getContentType()If this property is present, this is the content type.@NotNull Optional<@Immutable ByteBuffer>getCorrelationData()If this property is present, this is the correlation data.booleangetDupFlag()Iffalsethis is the first occasion the message is sent to the receiver.@NotNull Optional<Long>getMessageExpiryInterval()If this property is present, this is the message expiry interval.intgetPacketId()The packet identifier of the publish.@NotNull Optional<@Immutable ByteBuffer>getPayload()If this property is present, this is the payload.@NotNull Optional<PayloadFormatIndicator>getPayloadFormatIndicator()If this property is present, this is the payload format indicator.@NotNull QosgetQos()The quality of service level of the publish.@NotNull Optional<String>getResponseTopic()If this property is present, this is the response topic.booleangetRetain()Iftruethis message is a retained message, forfalsethis is just a normal publish.@Immutable @NotNull List<@NotNull Integer>getSubscriptionIdentifiers()The list of subscription identifiers for PUBLISH.longgetTimestamp()The arrival timestamp of the PUBLISH.@NotNull StringgetTopic()The topic filter the message is published to.@Immutable @NotNull UserPropertiesgetUserProperties()TheUserPropertiesof the PUBLISH.
-
-
-
Method Detail
-
getDupFlag
boolean getDupFlag()
Iffalsethis is the first occasion the message is sent to the receiver. Iftruethe message has already been sent once to the receiver.- Returns:
- The duplicate delivery flag.
- Since:
- 4.0.0, CE 2019.1
-
getQos
@NotNull Qos getQos()
The quality of service level of the publish.- Returns:
- The qos.
- Since:
- 4.0.0, CE 2019.1
-
getRetain
boolean getRetain()
Iftruethis message is a retained message, forfalsethis is just a normal publish.- Returns:
- The retain flag.
- Since:
- 4.0.0, CE 2019.1
-
getTopic
@NotNull String getTopic()
The topic filter the message is published to.- Returns:
- The topic.
- Since:
- 4.0.0, CE 2019.1
-
getPacketId
int getPacketId()
The packet identifier of the publish.- Returns:
- The packet identifier.
- Since:
- 4.0.0, CE 2019.1
-
getPayloadFormatIndicator
@NotNull Optional<PayloadFormatIndicator> getPayloadFormatIndicator()
If this property is present, this is the payload format indicator.For an MQTT 3 PUBLISH this MQTT 5 property will always be empty.
- Returns:
- An
Optionalthat contains the payload format indicator if present. - Since:
- 4.0.0, CE 2019.1
-
getMessageExpiryInterval
@NotNull Optional<Long> getMessageExpiryInterval()
If this property is present, this is the message expiry interval.For an MQTT 3 PUBLISH this MQTT 5 property will always have the value from the configured message expiry.
- Returns:
- An
Optionalthat contains the message expiry interval if present. - Since:
- 4.0.0, CE 2019.1
-
getResponseTopic
@NotNull Optional<String> getResponseTopic()
If this property is present, this is the response topic.For an MQTT 3 PUBLISH this MQTT 5 property will always be empty.
- Returns:
- An
Optionalthat contains the response topic if present. - Since:
- 4.0.0, CE 2019.1
-
getCorrelationData
@NotNull Optional<@Immutable ByteBuffer> getCorrelationData()
If this property is present, this is the correlation data.For an MQTT 3 PUBLISH this MQTT 5 property will always be empty.
The ByteBuffer returned by this method is
read onlyand will throw aReadOnlyBufferExceptionif handled incorrectly.- Returns:
- An
Optionalthat contains the correlation data if present. - Since:
- 4.0.0, CE 2019.1
-
getSubscriptionIdentifiers
@Immutable @NotNull @Immutable @NotNull List<@NotNull Integer> getSubscriptionIdentifiers()
The list of subscription identifiers for PUBLISH.For an MQTT 3 PUBLISH this MQTT 5 property will always be an empty list.
- Returns:
- The subscription identifiers.
- Since:
- 4.0.0, CE 2019.1
-
getContentType
@NotNull Optional<String> getContentType()
If this property is present, this is the content type.For an MQTT 3 PUBLISH this MQTT 5 property will always be empty.
- Returns:
- An
Optionalthat contains the content type if present. - Since:
- 4.0.0, CE 2019.1
-
getPayload
@NotNull Optional<@Immutable ByteBuffer> getPayload()
If this property is present, this is the payload.The ByteBuffer returned by this method is
read onlyand will throw aReadOnlyBufferExceptionif handled incorrectly.- Returns:
- An
Optionalthat contains the payload if present. - Since:
- 4.0.0, CE 2019.1
-
getUserProperties
@Immutable @NotNull @Immutable @NotNull UserProperties getUserProperties()
TheUserPropertiesof the PUBLISH.For an MQTT 3 PUBLISH this MQTT 5 property will always be an empty list.
- Returns:
- The user properties.
- Since:
- 4.0.0, CE 2019.1
-
getTimestamp
long getTimestamp()
The arrival timestamp of the PUBLISH.For an incoming PUBLISH message the timestamp represents the moment when the message arrived at the broker.
For a message created via the Extension SDK the timestamp represents the moment when the message is passed to the PublishService.
For a Will Publish that is sent to subscribers, the timestamp represents the moment when the delivery started (after the client disconnected ungracefully and the Will delay has passed).
The returned timestamp is a UNIX timestamp since midnight, January 1, 1970 UTC in milliseconds.
- Returns:
- The timestamp.
- Since:
- 4.4.0, CE 2020.4
-
-