You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by shunter <st...@hotmail.com> on 2008/10/05 07:12:32 UTC

Force connection failover?

The ActiveMQ client has a connection string with failover listing 2 activemq
brokers.

Is there a way to force activemq to failover to the next broker via a
function or method call?  So, while I understand activemq will fail over if
there is a network issue, i want to be able to force the failover based upon
various metrics calculated on the client side.

Does this functionality exist ?  how would i go ahead doing this.  thank you

-- 
View this message in context: http://www.nabble.com/Force-connection-failover--tp19820827p19820827.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Force connection failover?

Posted by Rob Davies <ra...@gmail.com>.


On 5 Oct 2008, at 06:12, shunter wrote:

>
> The ActiveMQ client has a connection string with failover listing 2  
> activemq
> brokers.
>
> Is there a way to force activemq to failover to the next broker via a
> function or method call?  So, while I understand activemq will fail  
> over if
> there is a network issue, i want to be able to force the failover  
> based upon
> various metrics calculated on the client side.
>
> Does this functionality exist ?  how would i go ahead doing this.   
> thank you
>
> -- 
> View this message in context: http://www.nabble.com/Force-connection-failover--tp19820827p19820827.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Bit long winded - but you can do something like this on your  
connection (called localConnection):


import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.transport.TransportFilter;
import org.apache.activemq.transport.failover.FailoverTransport;

doFailover() {
((FailoverTransport) ((TransportFilter) ((TransportFilter)
                     ((ActiveMQConnection) localConnection)
                     .getTransport()).getNext()).getNext())
                     .handleTransportFailure(new IOException("Forcing  
a Failure"));
}


cheers,

Rob

Rob Davies
http://fusesource.com
http://rajdavies.blogspot.com/








Re: Force connection failover?

Posted by Bruce Snyder <br...@gmail.com>.
On Sun, Oct 5, 2008 at 1:12 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Sat, Oct 4, 2008 at 11:12 PM, shunter <st...@hotmail.com> wrote:
>>
>> The ActiveMQ client has a connection string with failover listing 2 activemq
>> brokers.
>>
>> Is there a way to force activemq to failover to the next broker via a
>> function or method call?  So, while I understand activemq will fail over if
>> there is a network issue, i want to be able to force the failover based upon
>> various metrics calculated on the client side.
>>
>> Does this functionality exist ?  how would i go ahead doing this.  thank you
>
> Unfortunately this functionality does not exist today.

Whoops, my email hadn't updated for some reason. It looks like Rob
provided a workaround.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: Force connection failover?

Posted by Bruce Snyder <br...@gmail.com>.
On Sat, Oct 4, 2008 at 11:12 PM, shunter <st...@hotmail.com> wrote:
>
> The ActiveMQ client has a connection string with failover listing 2 activemq
> brokers.
>
> Is there a way to force activemq to failover to the next broker via a
> function or method call?  So, while I understand activemq will fail over if
> there is a network issue, i want to be able to force the failover based upon
> various metrics calculated on the client side.
>
> Does this functionality exist ?  how would i go ahead doing this.  thank you

Unfortunately this functionality does not exist today.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/