Class MqttMessage


  • public final class MqttMessage
    extends java.lang.Object
    Represents a message to publish, or a message that was received.
    • Constructor Summary

      Constructors 
      Constructor Description
      MqttMessage​(java.lang.String topic, byte[] payload)
      Deprecated.
      Use alternate constructor.
      MqttMessage​(java.lang.String topic, byte[] payload, QualityOfService qos)
      Constructs a new message.
      MqttMessage​(java.lang.String topic, byte[] payload, QualityOfService qos, boolean retain)
      Constructs a new message.
      MqttMessage​(java.lang.String topic, byte[] payload, QualityOfService qos, boolean retain, boolean dup)
      Constructs a new message.
    • Constructor Detail

      • MqttMessage

        public MqttMessage​(java.lang.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, the QualityOfService to use for delivery. When receiving, the QualityOfService 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​(java.lang.String topic,
                           byte[] payload,
                           QualityOfService qos,
                           boolean retain)
        Constructs a new message.
        Parameters:
        topic - Message topic.
        payload - Message payload.
        qos - QualityOfService. When sending, the QualityOfService to use for delivery. When receiving, the QualityOfService 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​(java.lang.String topic,
                           byte[] payload,
                           QualityOfService qos)
        Constructs a new message.
        Parameters:
        topic - Message topic.
        payload - Message payload.
        qos - QualityOfService. When sending, the QualityOfService to use for delivery. When receiving, the QualityOfService used for delivery.
      • MqttMessage

        @Deprecated
        public MqttMessage​(java.lang.String topic,
                           byte[] payload)
        Deprecated.
        Use alternate constructor.
        Parameters:
        topic - Message topic.
        payload - Message payload.
    • Method Detail

      • getTopic

        public java.lang.String getTopic()
        Gets the topic associated with this message
        Returns:
        The topic
      • getPayload

        public byte[] getPayload()
        Gets the message payload
        Returns:
        Message payload
      • 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