Package software.amazon.awssdk.crt.mqtt
Class MqttMessage
- java.lang.Object
-
- software.amazon.awssdk.crt.mqtt.MqttMessage
-
public final class MqttMessage extends Object
Represents a message to publish, or a message that was received.
-
-
Constructor Summary
Constructors Constructor Description MqttMessage(String topic, byte[] payload)
Deprecated.Use alternate constructor.MqttMessage(String topic, byte[] payload, QualityOfService qos)
Constructs a new message.MqttMessage(String topic, byte[] payload, QualityOfService qos, boolean retain)
Constructs a new message.MqttMessage(String topic, byte[] payload, QualityOfService qos, boolean retain, boolean dup)
Constructs a new message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getDup()
Gets the DUP flag.byte[]
getPayload()
Gets the message payloadQualityOfService
getQos()
Gets theQualityOfService
.boolean
getRetain()
Gets the retain flag.String
getTopic()
Gets the topic associated with this message
-
-
-
Constructor Detail
-
MqttMessage
public MqttMessage(String topic, byte[] payload, QualityOfService qos, boolean retain, boolean dup)
Constructs a new message.- Parameters:
topic
- Message topic.payload
- Message payload.qos
-QualityOfService
. When sending, theQualityOfService
to use for delivery. When receiving, theQualityOfService
used for delivery.retain
- Retain flag. When sending, whether the message should be retained by the broker and delivered to future subscribers. When receiving, whether the message was sent as a result of a new subscription being made.dup
- DUP flag. Ignored when sending. When receiving, indicates whether this might be re-delivery of an earlier attempt to send the message.
-
MqttMessage
public MqttMessage(String topic, byte[] payload, QualityOfService qos, boolean retain)
Constructs a new message.- Parameters:
topic
- Message topic.payload
- Message payload.qos
-QualityOfService
. When sending, theQualityOfService
to use for delivery. When receiving, theQualityOfService
used for delivery.retain
- Retain flag. When sending, whether the message should be retained by the broker and delivered to future subscribers. When receiving, whether the message was sent as a result of a new subscription being made.
-
MqttMessage
public MqttMessage(String topic, byte[] payload, QualityOfService qos)
Constructs a new message.- Parameters:
topic
- Message topic.payload
- Message payload.qos
-QualityOfService
. When sending, theQualityOfService
to use for delivery. When receiving, theQualityOfService
used for delivery.
-
MqttMessage
@Deprecated public MqttMessage(String topic, byte[] payload)
Deprecated.Use alternate constructor.
-
-
Method Detail
-
getTopic
public String getTopic()
Gets the topic associated with this message- Returns:
- The topic
-
getPayload
public byte[] getPayload()
Gets the message payload- Returns:
- Message payload
-
getQos
public QualityOfService getQos()
Gets theQualityOfService
. When sending, theQualityOfService
to use for delivery. When receiving, theQualityOfService
used for delivery.- Returns:
- The
QualityOfService
-
getRetain
public boolean getRetain()
Gets the retain flag. When sending, whether the message should be retained by the broker and delivered to future subscribers. When receiving, whether the message was sent as a result of a new subscription being made.- Returns:
- Retain flag
-
getDup
public boolean getDup()
Gets the DUP flag. Ignored when sending. When receiving, indicates whether this might be re-delivery of an earlier attempt to send the message.- Returns:
- DUP flag
-
-