Manual Ack confirmation cannot meet expectations

描述你需要的功能

“I tried to set manual Ack in the MQTT client (Client.setManualAcks), and set the callback function deliveryComplete before publish handling to process the ack confirmation messages. Before subscribing to subscribe(“test/#”, 2), I also set the Callback function, messageArrived to receive data, and let the thread wait 30 seconds, manually confirm ack (Client.messageArrivedComplete(mqttMessage.getId(), 1);). However, in my final test, when the publishing is completed and the receiving end finishes printing the data, deliveryComplete has received the completion confirmation.”

为什么你需要这个功能

In summary, you:

  1. Enabled manual ack in MQTT client using setManualAcks()
  2. Set callback deliveryComplete to handle ACKs
  3. Set callback messageArrived to receive data
  4. Wait 30 seconds in messageArrived before manually acking
  5. But observed that deliveryComplete gets called immediately after data is printed, not waiting 30 seconds.

Please let me know if you need any clarification or have additional questions!