Publishes.receive() moves to next message before acknowledge()

I have a scenario where I have a persistent session. The topic I have my client subscribed to has received 7 messages while it was offline. My client has now come back online and is trying to process those messages. When processing the message the client hits an error and does not acknowledge the message and instead starts over by calling receive on publishes.

I have my publishes set to manualAcknowledge=True. I would assume that if my client does a second receive without acknowledging it would receive the same message again, but it is receiving the next message in the queue. If I keep looping and calling publishes.receive() without publish.acknowledge it just keeps getting the next message until it loops around and starts over again with the first message in the queue. Why am I not receiving the same message over and over again when calling publishes.receive() without calling publish.acknowledge()? How do I stop this behavior?

Here is my example code:

Hi Jonathan,

If you are still experiencing the issue, please feel free to share your project (repository) along with the following details:

  1. Steps to build and execute the project.
  2. Steps to test the scenario you described.

Reproducing the error on our end is essential for troubleshooting it effectively. This will help us provide a more accurate and timely solution to your problem.

Thank you!

Best regards,
Dasha from the HiveMQ Team