Interface MqttMessage


public interface MqttMessage
An abstraction of the PUBLISH Control Packet, sent by a client and then passed to the Hook, before being encoded and finally delivered to the target MQTT broker.
  • Method Summary

    Modifier and Type Method Description
    byte[] getApplicationMessage()
    Gets the Application Message carried by this message.
    QoS getQos()
    Gets the Quality of Service level with which this message has been delivered.
    java.lang.String getTopicName()
    Gets the name of the topic to which this message is being published.
    boolean isDuplicate()
    Gets the duplicate flag of this message.
    boolean isRetained()
    Gets the retained flag of this message.
  • Method Details

    • getTopicName

      java.lang.String getTopicName()
      Gets the name of the topic to which this message is being published.
      Returns:
      the topic name
    • getApplicationMessage

      byte[] getApplicationMessage()
      Gets the Application Message carried by this message.

      The MQTT Protocol Specifications defines the Application Message as the payload of the PUBLISH Control Packet.

      Returns:
      the byte array containing the Application Message info
    • getQos

      QoS getQos()
      Gets the Quality of Service level with which this message has been delivered.
      Returns:
      the Quality of Service level
    • isRetained

      boolean isRetained()
      Gets the retained flag of this message.

      The retain flag specifies whether the MQTT broker must store this message, in order to be immediately delivered to future clients as they subscribe to matching topics.

      Returns:
      true if the retained flag is set
    • isDuplicate

      boolean isDuplicate()
      Gets the duplicate flag of this message.

      Only for messages with QoS level > 0, the duplicate flag indicates that this message might have been re-sent because not acknowledged in an earlier attempt.

      In case of QoS.AT_MOST_ONCE level, this method always returns false.

      Returns:
      true if the duplicate flag is set