Package com.plccom.mqtt.client
Class PlccomMqttPublishMessage
- java.lang.Object
-
- com.plccom.mqtt.client.PlccomMqttPublishMessage
-
public final class PlccomMqttPublishMessage extends Object
MQTT publish message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlccomMqttPublishMessage.BuilderBuilder for publish messages.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PlccomMqttPublishMessage.Builderbuilder(String topic)Creates a publish builder.StringgetContentType()Returns the MQTT 5 content type property.byte[]getCorrelationData()Returns a defensive copy of the MQTT 5 correlation data property.LonggetMessageExpiryIntervalSeconds()Returns the MQTT 5 message expiry interval.byte[]getPayload()Returns a defensive copy of the payload.BooleangetPayloadFormatUtf8()Returns the MQTT 5 Payload Format Indicator property.PlccomMqttQualityOfServicegetQualityOfService()Returns the requested publish QoS.StringgetResponseTopic()Returns the MQTT 5 response topic property.List<Integer>getSubscriptionIdentifiers()Returns MQTT 5 Subscription Identifiers carried by an inbound PUBLISH.StringgetTopic()Returns the publish topic.List<PlccomMqttUserProperty>getUserProperties()Returns the MQTT 5 user properties.booleanisRetain()Returns whether the broker should retain the publish.
-
-
-
Method Detail
-
builder
public static PlccomMqttPublishMessage.Builder builder(String topic)
Creates a publish builder.- Parameters:
topic- MQTT topic- Returns:
- builder
- Throws:
NullPointerException- whentopicisnullduringPlccomMqttPublishMessage.Builder.build()IllegalArgumentException- whentopicis empty duringPlccomMqttPublishMessage.Builder.build()
-
getTopic
public String getTopic()
Returns the publish topic.- Returns:
- MQTT topic name
-
getPayload
public byte[] getPayload()
Returns a defensive copy of the payload.- Returns:
- publish payload, never
null
-
getQualityOfService
public PlccomMqttQualityOfService getQualityOfService()
Returns the requested publish QoS.- Returns:
- QoS level used for the outgoing publish
-
isRetain
public boolean isRetain()
Returns whether the broker should retain the publish.- Returns:
truewhen the MQTT retain flag is set
-
getPayloadFormatUtf8
public Boolean getPayloadFormatUtf8()
Returns the MQTT 5 Payload Format Indicator property.A value of
Boolean.TRUEmeans the sender declared the payload to be UTF-8 encoded character data. A value ofBoolean.FALSEmeans the sender declared the payload to be unspecified binary data.nullmeans the property was not present and receivers should apply their normal application rules.- Returns:
- payload format hint, or
nullwhen none was set
-
getContentType
public String getContentType()
Returns the MQTT 5 content type property.- Returns:
- content type, or
nullwhen none was set
-
getMessageExpiryIntervalSeconds
public Long getMessageExpiryIntervalSeconds()
Returns the MQTT 5 message expiry interval.- Returns:
- expiry interval in seconds, or
nullwhen the broker should use its default behavior
-
getResponseTopic
public String getResponseTopic()
Returns the MQTT 5 response topic property.- Returns:
- response topic, or
nullwhen none was set
-
getCorrelationData
public byte[] getCorrelationData()
Returns a defensive copy of the MQTT 5 correlation data property.- Returns:
- correlation data, or
nullwhen none was set
-
getUserProperties
public List<PlccomMqttUserProperty> getUserProperties()
Returns the MQTT 5 user properties.- Returns:
- immutable list of user properties, never
null
-
getSubscriptionIdentifiers
public List<Integer> getSubscriptionIdentifiers()
Returns MQTT 5 Subscription Identifiers carried by an inbound PUBLISH.A broker can include one or more identifiers when the PUBLISH matches subscriptions that were created with MQTT 5 Subscription Identifiers. The list is empty when no identifier was present. The client-side PUBLISH encoder does not send these values because MQTT 5 only allows this property on server-to-client PUBLISH packets.
- Returns:
- immutable list of Subscription Identifiers, never
null
-
-