Is the consumer connection factory configured to retry connections after a
failure?  If so, in the test, is there some additional step that prevents
the client from reconnecting?

For most applications, I recommend that consumers try indefinitely without
interrupting the application.  Any logic placed in the application to
handle the situation will be extra complexity with little benefit since the
libraries already do the work of reconnecting.

For JMS, the best way for an application to detect a lost connection is via
the ConnectionListener.

With that said, most applications just want to be as durable as possible,
and monitoring is the best way to detect and correct such a scenario.

Hope this helps.

Art



On Wed, Jun 16, 2021 at 8:26 AM <kst...@gmail.com> wrote:

> 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
> >
> >
>
>

Reply via email to