activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: Force connection failover?
Date Sun, 05 Oct 2008 18:36:04 GMT



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/








Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message