Bridge feature not avoiding loops #1263
A few months ago I was developing an mqtt bridge (a program that would make sure two brokers see the same set of messages by subscribing to # on both brokers and forwarding data). We are not doing any topic remapping.
The problem was when I subscribed to #, I got my own messages delivered back to me causing an endless message storm and loop. I wanted to be able to forward the data between two brokers using my own code without having to parse the messages. So I wanted mosquitto broker to not send me data that I published. I looked around a bit and found that mosquitto supports briding and decided to use the way they have solved the problem. @ralight described the solution here in 4th post from top. This is also explained in the
So I implemented the solution in python paho library to support bridge mode. Link is here and got it in the master.
A few days ago Mosquitto released a new version for the ubuntu channel (Version 1.6.2) and I noticed that the bridge mode is not working. When I publish the message in bridge mode after subscribing to # on broker version 1.6.1 I get that same message back, however in many 1.5.* and 1.4.* I am not getting the same message back.
The reason I wrote such a detailed post is so this document can also serve as information archive in the future.