Edit to simplify. All is well with multiple clients publishing and subscribing to a Mosquitto broker on a Raspberry PI. All topics of the form: garden/#
Now establish a bridge to HiveMQ Cloud using a basic Mosquitto.conf bridge setup:
A client connected to HiveMQ can subscribe to messages on topics of the form estate/garden/# published by clients of the Rpi all OK. A single message is received on the HiveMQ client as expected.
However, with the bridge established, clients subscribing to the Rpi get duplicate messages. Without the bridge they get a single message as expected.
Why is this bridge seemingly creating a message loop that results in messages to the Rpi (the client half of the bridge) being duplicated?
Great that you are using a Mosquitto Bridge to connect your clients to the HiveMQ Cloud. What is the reason you have to use Mosquitto Bridge in your IoT setup? Do I understand correctly, that the reason for that is that your clients cannot connect to the HiveMQ Cloud on their own, so their first connect via supported protocol to the Mosquitto Bridge, that supports the connection to the HiveMQ Cloud broker?
That’s correct, all my edge IoT clients are Raspberry Pi Pico W running Micropython and the ‘mqtt_as’ module. I gave up trying to connect the Pico W direct to HiveMQ Cloud and connected the clients to a Mosquitto broker on a non-Pico Raspberry Pi 3B. I have no problem with multiple bridges between numerous Mosquitto brokers on various non-Pico Raspberry Pi and Ubuntu laptop in various topologies and all topics/messages are published and subscribed as expected. It’s just when I bridge one of the Raspberry Pi Mosquitto brokers to HiveMQ that the clients on the Pico/Mosquitto brokers all get instant duplicate messages. All the clients use QoS=1 and the broker-bridges QoS=0. Another standalone laptop-based Paho-client connected to the HiveMQ does not get the duplicate messages.
So I’m convinced my message duplication problem is a function of the bridge to the HiveMQ Cloud broker.
Bad news: The issue is called looping, it is happening because your bridge is both publishing to the remote broker and subscribed to it. To prevent this from happening Mosquitto bridge has a special option try_private: (mosquitto.conf man page | Eclipse Mosquitto).
In your mosquitto.conf this option is disabled, hence the looping:
However this option is not supported by HiveMQ broker, so you cannot enable it either.
Thank you for the clarification - good to get a definitive answer: a Mosquitto broker cannot bridge to a HiveMQ Cloud broker without getting topic looping.