Reputation: 155
I am trying to understand where are the qos 1 messages stored for redelivery in case of subscriber disconnection.
By my understanding when a disconnected subscriber reconnects with clean session as false, the lost messages are redelivered to the subscriber.
Now in the mqtt libraries like paho you have to create a mqtt client with a file/memory persistence defined. Does the publisher client stores these messages using this persistent storage or the mqtt broker stores the messages for qos 1/2 delivery?
And what is the client persistence used for?
Upvotes: 1
Views: 288
Reputation: 59826
It is important to remember that delivery is always only ever between 1 client and the 1 broker at a time, it is NOT end to end between 2 clients.
So messages are persisted by the which ever end of the connection is doing the sending until it has been acknowledged as properly received by the receiver.
So for a publishing client sending a message with QOS 1 or 2 it will persist the message until the broker has acknowledged receipt.
Then the broker will persist the message when it starts to send it to a client with a QOS 1 or 2 subscription and keep it until the client has acknowledged receipt.
The broker will persist the message until it has been delivered to all QOS 1 or 2 subscribed clients
Upvotes: 2