Industrial IoT · Industrial Automation
Count the production event once when MQTT delivers it twice
MQTT QoS 1 permits repeat delivery. Give each production event a stable identity and test what happens when a site gateway reconnects.

A remote packing shed reports 401 completed crates in its cloud dashboard. The local counter lists 400. The discrepancy appeared after a network interruption. With MQTT quality of service 1, a receiver can legitimately see an application message more than once. A count should reflect the production event being reported.
Keep identity with the original observation
Create or capture an event identifier at the producer, persist it with the observation and retain it on retransmission. Include a device identity and a sequence or other identifier that survives the intended retry window. Account for a device reboot or counter wrap so old and new observations cannot collide. A transport packet identifier alone has a different lifetime.
Replay the example identifiers A17, A18, A18 and A19 through a test consumer. Four deliveries should produce three unique business events. Repeat with two different devices both reporting local sequence 18. If your key includes the device, these distinct events can both be retained.

What to check on site
Write the event and its deduplication key together in the receiving store.
Keep delivery count and unique production count available as different diagnostics.
Retest after a reconnect, after a device reboot and after the chosen retention period.
This test can be run on recorded data from an Australian packing shed or New Zealand coolstore. No changes to live control logic are needed to establish whether the reporting path counts repeats.
Sources and photograph
OASIS — MQTT 3.1.1 specification
A remote packing shed reports 401 completed crates in its cloud dashboard. The local counter lists 400. The discrepancy appeared after a network interruption. With MQTT quality of service 1, a receiver can legitimately see an application message more than once. A count should reflect the production event being reported.
Keep identity with the original observation
Create or capture an event identifier at the producer, persist it with the observation and retain it on retransmission. Include a device identity and a sequence or other identifier that survives the intended retry window. Account for a device reboot or counter wrap so old and new observations cannot collide. A transport packet identifier alone has a different lifetime.
Replay the example identifiers A17, A18, A18 and A19 through a test consumer. Four deliveries should produce three unique business events. Repeat with two different devices both reporting local sequence 18. If your key includes the device, these distinct events can both be retained.

What to check on site
Write the event and its deduplication key together in the receiving store.
Keep delivery count and unique production count available as different diagnostics.
Retest after a reconnect, after a device reboot and after the chosen retention period.
This test can be run on recorded data from an Australian packing shed or New Zealand coolstore. No changes to live control logic are needed to establish whether the reporting path counts repeats.
Sources and photograph
OASIS — MQTT 3.1.1 specification