In reference to this article I think I know the difference between QoS1 and QoS2 messages, but I don't know the difference in handling both of them as a Paho MQTT client.
Imagine I subscribe to the topic like this:
MqttClient subscriber = new MqttClient(SERVER_URI, SUBSCRIBER_ID);
subscriber.subscribe(TOPIC);
And then I'm publishing messages like this:
publisher.publish(TOPIC, PAYLOAD, 1, false);
At this moment I'm using MqttCallback interface to handle messages that arrives to subscribers.
There is a method to override:
public void messageArrived(String topic, MqttMessage mqttMessage) {
if(mqttMessage.isDuplicate()) {
// is it really the duplicate message from my perspective?
} else {...}
}
In the MqttMessage we can find a isDuplicate() method, but how can I be sure that the mqttMessage that returns true is not the first message that my subscriber received?
I am very interested in finding a solution that shows how to handle QoS1, but every answer which will clarify anything here will be appreciated.
Best regards from Cracow!