Mosquitto bridge and retain behaviour [message #1840976] |
Thu, 29 April 2021 12:42  |
Eclipse User |
|
|
|
Hi everyone,
I have a "problem" related to MQTT bridge and retained messages. I actually can't tell whether this is expected behaviour or if it's a bug, so I post here rather than github.
I have 2 Mosquitto bridged together. The relevant bit of config is:
- connection bridge-01
- address myawesomemqtt:1883
- try_private true
- topic # out 2 London/ test/London/
- bridge_protocol_version mqttv50
- bridge_outgoing_retain true
Assume MQTT1 is the local server with the bridge configured and MQTT2 is the remote MQTT server that is part of the bridge (but nothing special in its config). Assume MQTT1 has a retained msg on topic "London/whatever" with message being "off". When I restart MQTT1, I get:
- On MQTT1, on topic "London/whatever", I get a message "off" with the retain bit set to true. This is what I would expect.
- On MQTT2, on topic "test/London/whatever", I get a message "off" with the retain bit set to false. This is NOT what I would expect. I would have expected the retain bit to be set to true because that message came from MQTT1 from a retain message.
Is the above expected behaviour or is that a bug? Or problem in my setup?
Thanks for the help.
|
|
|
|
|
Re: Mosquitto bridge and retain behaviour [message #1840990 is a reply to message #1840989] |
Thu, 29 April 2021 17:48  |
Eclipse User |
|
|
|
Ah found it!
For whoever might be facing a similar problem:
I am using NodeRed for my project. In the MQTT nodes, there are flags that can be enabled. Among which I found "Keep retain flag of original publish" which is exactly what I needed to enable. Now the messages are propagated across the bridge with the retain flag still on.
Thanks again Roger.
|
|
|
Powered by
FUDForum. Page generated in 0.06267 seconds