androidmqttmessagebrokerbrokerandroid-open-accessory

Regarding MQTT PubAck with QoS level one


In this tutorial in the section of message options

By default, a new message instance is set to "At Least Once", a Quality of Service (QoS) of 1, which means the sender will deliver the message at least once and, if there's no acknowledgement of it, it will keep sending it with a duplicate flag set until an acknowledgement turns up,

does it mean that in the setCallback listener-> onMessageArrived() i have to check if any message arrived I have to resend the message again with duplicat flag set?


Solution

  • No it means the broker will continue to send the message to the subscriber until it gets an acknowledgment. The paho mqtt client code should handle this all for you.

    The only thing you may want to do when using QOS1 is to check for duplicate messages in the onmessage callback. The best way to do this is to include a unique of in the message payload