Thanks, opened: https://issues.apache.org/jira/browse/ARTEMIS-3351 Closing the connection does throw an exception as expected, so the issue is related to closing the session.
> This looks like a bug to me. Can you open a Jira [1]? > In the meantime it looks like you can close the *consumer* via the web > console instead of the session. That should trigger an exception on the > client as expected. > Justin On Wed, Jun 16, 2021 at 7:45 AM <kst...@gmail.com> wrote: > Hello, > > I am using Artemis 2.17.0. I am trying to see how to detect a closed > session from a client consumer. My use case is this: > > * Create a consumer (using JMS or core, same behavior) > * I use a thread to loop indefinitely using consumer.receive(1000); > * I create a producer and send messages in another thread. > * Consumers receive messages and keep looping as expected > * I am using the Management console, go to tab Sessions, locate the > consumer sessions and hit the 'Close' button to close the sessions. > When I do this, my consumer block indefinitely in the receive method > and there is no exception or another way to unblock them. > > > > The behavior is the same if I use receiveNoWait(); also the same if I > use > consumer.setMessageListener() to be notified. > > In short, after I close the sessions from the management console, I > have no way whatsoever to find out from the consumer that this session > is now > closed: it seems that the receive() methods there block indefinitely > with no exception being thrown. > > > > Thanks for any help, > > Costas > >