Reputation: 1016
Can I prevent duplicate message sent to bridge? I've set the duplicate flag from client, but the broker still send new message with dup = 0.
The message m870 is sent twice, because the first time PUBACK is not received by client (maybe some internet broke in the middle). Client re-deliever m870 with dup = 1, but server still send the message to broker with dup = 0. (That makes other broker connects to bridge thought this message is new, and publish to all the subscribed clients).
1488965834: Received PUBLISH from client (d0, q1, r0, m870, 'test/topic', ... (10 bytes))
1488965834: Sending PUBACK to client (Mid: 870)
1488965834: Sending PUBLISH to bridge (d0, q1, r0, m58118, 'B/test/topic', ... (10 bytes))
1488965834: Received PUBACK from bridge (Mid: 58118)
1488965838: Received PUBLISH from client (d1, q1, r0, m870, 'test/topic', ... (10 bytes))
1488965838: Sending PUBACK to client (Mid: 870)
1488965838: Sending PUBLISH to bridge (d0, q1, r0, m58121, 'B/test/topic', ... (10 bytes))
1488965838: Received PUBACK from bridge (Mid: 58121)
This question is also post to mosquitto/issues/398
Upvotes: 0
Views: 983
Reputation: 59826
I think you are miss understanding the dup flag.
This flag is set by the a client when it is re-delivering a QOS 1/2 message to the broker that didn't confirm arrival of the original version message sent.
It is also set by the broker when doing the same to a client.
Each of these transactions is separate, setting it on the publishing client for the first time a message is sent will not achieve anything.
Details in the spec here: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349261
Upvotes: 0