activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin C." <>
Subject Re: How can a producer/consumer tell if its connection is still good?
Date Sat, 10 Dec 2011 16:10:03 GMT

I'd tend to use Spring's SingleConnectionFactory with
reconnectOnException set to true. I'd compare my cached connection
against the one returned by the SingleConnectionFactory to know if any
other consumer encountered a JMS exception.

Basically I'd also treat any JMSException I encounter as a reason to
recycle my connection and other JMS objects.

Best regards,

On Sat, Dec 10, 2011 at 1:25 AM, JRR <> wrote:
> Hello,
> I am using the Active MQ CPP 3.4.0 client.
> We have a multi-threaded application that has multiple producers, and they
> share a single connection. These connections are */not/* fail over
> connections, nor can they be.
> I'm trying to find the fastest, most efficient way to determine if a
> connection is still up? For example, consider if the broker was up, then my
> application starts, and establishes its connection and sends a few messages.
> Then later the broker restarts. So, I need to reestablish the connection.
> What I've done so far is get the cached connection. And then try to create a
> session on it. If the session create throws an exception, I create a new
> connection.
> However, this feels clunky/kludgy.
> Is there a better way to do this?
> Oh, I did look at advisory messages, but there isn't an advisory for
> creating the connection, there's an advisory for start and stop.
> Thank you,
> -=John
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

View raw message