Hi all,
I've implemented a work queue, similarly to
https://www.rabbitmq.com/tutorials/tutorial-two-dotnet.html. I've specified my QOS to 0/1 and no autoAck, just like the example. Now when the consumer is shutdown, the channel will be closed and if there was a message being processed it is returned to the queue. However now the following two things happen:
1. The actual processing of the task is still ongoing in the default task scheduler as long as the executable is still running. This can be observed by adding an additional `Console.ReadLine()` after the disposal of the `connection` and `channel`. This means that the message that was returned to the queue, might actually complete, but the queue won't be notified.
2. The actual processing will be killed when the executable is stopped. This means that it will be stopped at an arbitrary point in the execution.
The work I'm putting on the queue is not idempotent and handling of the messages doesn't occur in a database transaction. As a result, shutting down a consumer that's still processing work will cause data corruption. So, I'm looking for a way to shutdown the consumer that waits for completion of any messages that are already being processed. Pre-fetched items should be returned to the queue.
Thank you,
Bouke