camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lsclark <lisa.cl...@rackspace.com>
Subject Re: Camel in Master/Slave ActiveMQ config
Date Thu, 03 Jul 2008 17:09:13 GMT


James.Strachan wrote:
> 
> 
> if the master JVM dies, so will its camel context - and the slave
> won't startup until it becomes the master (so its camel context won't
> be active) - so I think it should work fine.
> 
> 

I've been working through strategies of how to failover a durable subscriber
to a remote JMS topic in a master/slave ActiveMQ configuration.  I found
during testing that embedded camel routes are started and active on the
slave(s) upon slave startup (and their startup is not influenced by
master/slave failover).

Still, by defining a Camel endpoint using a durable subscriber that uses the
same clientId and subscriptionName across the master/slaves, you could get
failover of the subscriber.  But I was running into issues of the slave
having failed to connect due to the master having already connected with
that clientId/subscriptionName.  And upon failover, the slave did not try to
reconnect (probably a config parameter that could be tweaked to decrease the
retry wait time?).  Also, in JDBC or Shared FS Master/Slave configs with 2+
slaves, can you be sure that the broker that was first to establish the
durable subscriber connection is the same broker that is currently master? 
Is there a listener/flag/something that could tell a slave that it is a
master, and thus influence Camel to stop/start a route?  (ActiveMQ 5.2
AdvisoryTopic.MasterBroker might work here).

The best solution that I've come up with to get failover of a durable
subscriber is to not use a Camel route, but use a JMSBridgeConnector to
bridge messages from the remote broker to the active master broker.

To show that camel routes are started on slaves, I've attached three config
files to simulate a remote broker, a master broker, and a slave broker.  I
have both the master and slave broker configured with camel routes that
establish different durable subscribers on the remote broker and pull
messages.  If you startup the remote, then master, then slave, you'll see
that both the master and slave have durable topic connections registered on
the remote.  If you produce messages on the remote's durableSubscriberTest
topic, you'll see that the master's camel route pulls these messages to its
masterDurableSubscriberTest topic, and that the slave also pulls these
messages to its slaveDurableSubscriberTest topic.

If I've completely flubbed up this configuration and left something out that
would make this camel route be influenced by master/slave failover, please
let me know.

http://www.nabble.com/file/p18264114/activemq_remote.xml activemq_remote.xml 
http://www.nabble.com/file/p18264114/activemq_master.xml activemq_master.xml 
http://www.nabble.com/file/p18264114/activemq_slave.xml activemq_slave.xml 
-- 
View this message in context: http://www.nabble.com/Camel-in-Master-Slave-ActiveMQ-config-tp18225430s22882p18264114.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message