You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by vts2011 <vt...@gmail.com> on 2013/02/11 17:31:13 UTC

Failover event

Hello,

I' using ActiveMQ with several brokers and failover schema. It looks like 


failover:(tcp://local:61616,tcp://remote:61616)?randomize=false&priorityBackup=true

I would like to know how I can capture the event when a broker is selected
(because the local is down or the local is up again), ¿Is there a listener
that fires any related event or something like that?

Thanks in advance



--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-event-tp4663180.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re:Re: Failover event

Posted by SuoNayi <su...@163.com>.
The command BrokerInfo is telling you what broker your client has connected,
When the broker is shut down,the transportInterupted method of TransportListener 
is called and it indicates that your client has disconnected with the broker which 
the previous BrokerInfo represents.



At 2013-02-12 17:50:15,vts2011 <vt...@gmail.com> wrote:
>I've been trying implementing TransportListener interface and passing a
>reference to ActiveMQConnectionFactory. I could see that when I launch my
>application the transportResumed method is called and then the onCommand
>method several times, with a WireFormatInfo object, a BrokerInfo object and
>a ConnectionControl object as parameters in the different invocations. When
>I turn down the master broker, I can see that the transportInterupted is
>called but as this method does not receive any parameter, how can I know
>what the broker that go down was? Later when I turn up the master broker
>again, I can see the calls to the transportResumed and onCommand methods but
>I have no hint of with broker is the one active, how can I know what the
>active broker is?
>
>Thank you
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/Failover-event-tp4663180p4663230.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Failover event

Posted by vts2011 <vt...@gmail.com>.
I've been trying implementing TransportListener interface and passing a
reference to ActiveMQConnectionFactory. I could see that when I launch my
application the transportResumed method is called and then the onCommand
method several times, with a WireFormatInfo object, a BrokerInfo object and
a ConnectionControl object as parameters in the different invocations. When
I turn down the master broker, I can see that the transportInterupted is
called but as this method does not receive any parameter, how can I know
what the broker that go down was? Later when I turn up the master broker
again, I can see the calls to the transportResumed and onCommand methods but
I have no hint of with broker is the one active, how can I know what the
active broker is?

Thank you



--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-event-tp4663180p4663230.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Failover event

Posted by Timothy Bish <ta...@gmail.com>.
On 02/11/2013 11:31 AM, vts2011 wrote:
> Hello,
>
> I' using ActiveMQ with several brokers and failover schema. It looks like
>
>
> failover:(tcp://local:61616,tcp://remote:61616)?randomize=false&priorityBackup=true
>
> I would like to know how I can capture the event when a broker is selected
> (because the local is down or the local is up again), ¿Is there a listener
> that fires any related event or something like that?
>
> Thanks in advance
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-event-tp4663180.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

ActiveMQConnection allows you to add TransportListener instances as does 
the ActiveMQConnectionFactory, this interface has method for transport 
interruption and resume which correspond to the connection being broken 
/ restored.

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