Search code examples
javaandroidmqttpaho

Does Eclipse Paho Mqtt Client persist all the published messages published till they are ACKed for delivery by the broker under QoS-2?


Does the default PAHO MQTT implementation persist all the messages that are being pushed, until their delivery is confirmed specifically in QoS 2 ? Or if not how is it possible to implement such by our own?

UPDATE Since paho android service version 1.1.0 automatic reconnect and offline buffering features are implemented. For more info : https://www.eclipse.org/paho/clients/android/


Solution

  • From the javadoc for MqttClient

    By default MqttDefaultFilePersistence is used to store messages to a file. If persistence is set to null then messages are stored in memory and hence can be lost if the client, Java runtime or device shuts down.

    This means as long as you set the path correctly and have the right Android permissions to write to local storage, QOS2 messages should be persisted until delivered to the broker (not the end subscribers).