By default, when a client unsubscribes from a topic, the topic updates that are already queued for delivery to the client are delivered.
These messages can be cleared from the queue if the client does not want to receive them.
After a message is queued for a client, its delivery is guaranteed. This means that a client can unsubscribe from a topic but still receive messages queued for it on it on that topic. This is generally what is required as the messages were sent whilst the client was subscribed.
However, it can be decided that once the client has unsubscribed from a topic then the client no longer has any interest in any messages for that topic and such messages are removed from the queue. To achieve this there is an option on a topic, using setTidyOnUnsubscribe() to indicate that messages for the topic must be removed from client queues when the client unsubscribes from that topic.
Please sign in to leave a comment.