Skip to content
Advertisement

How to prevent Paho to send an ACK after processing a message from the broker?

I am working on a project with Paho on Java. Messages received from the broker are sent to an API that processes them, but this process might fail or take to long. I would like to take advantage of MQTT acknowledgement system and, in such cases, prevent the ACK to be sent so the broker resends the same message after a while. Is this possible with Paho?

Regards.

Advertisement

Answer

There is no way to guarantee that this will work. Message retries are implementation specific.

Section 4.4 of the MQTT v3.1.1 spec states

When a Client reconnects with CleanSession set to 0, both the Client and Server MUST re-send any unacknowledged PUBLISH Packets (where QoS 0) and PUBREL Packets using their original Packet Identifiers [MQTT-4.4.0-1]. This is the only circumstance where a Client or Server is REQUIRED to redeliver messages.

The emphasis is mine.

The trend I’ve seen is for implementations to remove message retries except for when reconnecting.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement