Hi Michael,
Thanks for your answer, it helped me figuring out the problem is with acking a message after the channel have been closed.
So if I catch the error with a try catch around ch.ack(msg);, then it's a bit better, but that message should be acked.
- introduced a counter variable processing -- if it's zero, then no messages are processed, so it's safe to close the channel
- added cancelling the consumer, it should stop new messages coming
- when no messages are processed anymore (retrying it every 100 ms), then I'm closing the channel and the connection
It seems to be working, but I'm interested in any thoughts about this solution.
Bye,
Andras