Retain gives the possibility to store the last message for immediate pickup and persistent sessions gives the possibility to store and pickup all missed messages to a session after reconnection.
Is it possible to configure a topic such that you combine those features so that after a session break you get only the last message you missed, if any. If there were no new messages the subscriber would not be sent anything.
This would allow not missing updates, but also not getting updates that are no longer valid.
topics are created on the fly by messages being sent to them.
They cease to exist after all messages are delivered according
to their QoS.
If no client with a persistent connection is subscribed to a topic,
The broker only keeps the most recent message with the retain flag.
This single message is sent to a client subscribing to said topic.
If a client connects to a broker without specifying the session to be
persistent, it will only receive the latest ‘retained message’ as well as all
messages published to the topic while it remains connected.
Does this describe the behaviour you are trying to achieve?
If using retained messages but not persistent, the subscriber can receive the same message twice if it subscribes twice because of a disconnect? (which I want to avoid because of bandwidth and other technical reasons)
So:
NOT receiving the latest retained message if the subscriber already received that message in a previous connection
AND only receiving the latest message even if there were several published while disconnected
I think what I’m looking for is an option to set the persistent queue size to have a size of only 0 to 1. (because all the older messages on the topic are made invalid by a newer message). I guess another number than 1 could also be useful if say you want to know the last 3 messages on the topic that the subscriber did not receive.