On Wed, 23 Aug 2017 20:05:35 GMT Justin Bertram wrote: > So I just looked at the code again and I totally missed the Thread.sleep() > in consumeMessage() which nullifies my previous theory.
My actual consumer code closes the session when the process is shut down. But, I guess in some cases this could actually result in the race condition you described where a session gets closed before a message handler acknowledges the message it's processing. What's the correct way to shut down a consumer process when using message handlers? If I try to wait until all received messages get acknowledged this may never occur if there're always messages in the queue, right? >From an API user perspective I'd expect to do something like the following: 1. disable receipt of any new messages 2. wait until all received messages get processed and acknowledged 3. close session How would disable receipt of new messages? Does Artemis API provide any mechanism for waiting until all received messages have been acknowledged or should I use something from java.util.concurrent? marko