如何防止 Paho 在处理来自代理的消息后发送 ACK?

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

我正在 Java 与 Paho 合作一个项目。从代理收到的消息被发送到处理它们的 API,但这个过程可能会失败或需要很长时间。我想利用 MQTT 确认系统,在这种情况下,阻止发送 ACK,以便代理在一段时间后重新发送相同的消息。 Paho 可以吗?

此致。

无法保证这会奏效。消息重试是特定于实现的。

MQTT v3.1.1 规范的

Section 4.4

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.

重点是我的。

我所看到的趋势是实现删除消息重试,重新连接时除外。