I am attempted to bridge 2 brokers and subscribe to one end, and publish to the other, and can see messages are getting lost.
Steps to reproduce:
Using mosquitto version 1.4.8
1.) Run broker with settings:
2.) Run broker + bridge with settings:
topic /i/+/loads out 2
topic /i/+/hq in 2
3.) Establish a non clean subscription to bridge broker with a fixed id
mosquitto_sub -h localhost -p 9000 -t "/i/+/hq" -c -q 2 -i i0
4.) Close subscriber from step 3. Close bridge from step 2. Now only the broker from step 1 is running.
5.) publish a message with
mosquitto_pub -h localhost -p 9001 -q 2 -t "/i/i0/hq" -m "abc"
6.) restart broker/bridge from step 2. If -v is enabled, observe it recieve the abc message.
7.) rerun subscription from step 3. Observe the message is lost.
This appears to be a bug with persisting topics that start with a /, thanks for reporting it.
You can get around it for now by removing the leading /. Honestly, there's no reason to have it there you're just complicating your hierarchy. Unlike a unix file system, / isn't the base, "" is. Using /i/i0/hq as a topic gives you four levels of hierarchy "", "i", "i0", "hq".
Thank you for looking at this so fast, and thanks for the advice.
Fix saving of persistence messages that start with a '/'.
Closes #151. Thanks to Andrew Chambers.
Signed-off-by: Roger A. Light <firstname.lastname@example.org>