You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dani Kaplan <ka...@gmail.com> on 2014/10/06 12:48:14 UTC

How can I "catch" ActiveMQ server disconnects in the client ?

I'm using the Dot Net NMS client.
Once the server goes offline I get an exception on the listener thread
(which I can only catch on the application level)

I have 2 question.
1. Is there a way to catch the error like a message (adding "OnError" event
like OnMessage)
2. I decided to periodically test the consumer for the connection state.
    I can see in the watch that there is a property named "Closed" in the
MessageConsumer Class the reflects the connection status. for some reason I
can't access this properties (it will not compile as if it doesn't exists in
the class or the interface) casting did not help.

What would be the best way to handle server disconnect - (I want to wait a
min, and try to reconnect again)

Thanks, 
Dani




--
View this message in context: http://activemq.2283324.n4.nabble.com/How-can-I-catch-ActiveMQ-server-disconnects-in-the-client-tp4686161.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How can I "catch" ActiveMQ server disconnects in the client ?

Posted by Timothy Bish <ta...@gmail.com>.
On 10/06/2014 06:48 AM, Dani Kaplan wrote:
> I'm using the Dot Net NMS client.
> Once the server goes offline I get an exception on the listener thread
> (which I can only catch on the application level)
>
> I have 2 question.
> 1. Is there a way to catch the error like a message (adding "OnError" event
> like OnMessage)
> 2. I decided to periodically test the consumer for the connection state.
>      I can see in the watch that there is a property named "Closed" in the
> MessageConsumer Class the reflects the connection status. for some reason I
> can't access this properties (it will not compile as if it doesn't exists in
> the class or the interface) casting did not help.
>
> What would be the best way to handle server disconnect - (I want to wait a
> min, and try to reconnect again)
>
> Thanks,
> Dani
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-can-I-catch-ActiveMQ-server-disconnects-in-the-client-tp4686161.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Why not use the failover transport?

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/