On 5/8/24 05:56, Devriendt, Erik wrote:
Hello all
I have a question about retained messages in MQTT.
I have 2 federated activeMQ Artemis 2.32.0 brokers A and B.
When I start a MQTT client on broker A that publishes a retained message on a
given topic and then exits, a second MQTT subscriber client started later and
connected to that same broker does receive the retained message.
However, a MQTT subscriber client connecting to broker B does not receive the
retained message. It does receive messages when the publishing client on broker
A is actively publishing messages.
Is this known behavior?
Is there a way to provide the retained message also to late subscribers on
broker B?
This is working as I'd expect it to as the federation will either be
using the Core protocol or the AMQP protocol depending on what you have
configured (not provided in your original message). These protocols are
simply reading from a matching address or queue and moving the messages
produced there to the other broker.
The MQTT implementation on the broker has a lot of extra smarts to store
off the retained message into another location and replay it any time an
MQTT subscriber attaches to a matching address and then replays the
retained message, this mechanism does not exist for Core or AMQP
subscribers so the federation bits are blind to the MQTT mechanisms at
play and can't provide retained messages sent when the federation link
was offline.
--
Tim Bish