camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lsclark <>
Subject Re: Camel in Master/Slave ActiveMQ config
Date Mon, 24 Nov 2008 22:39:16 GMT


   I haven't heard anything else from the list outside of what's posted
here.  I did verify through testing that master/slave brokers do start
embedded camel routes when the broker starts up.  Typically this isn't an
issue because the camel routes are working off of broker queues that are
produced to only if the broker is the master.  But it does pose problems if
you want to configure camel to be a durable subscriber to an external

   To have a durable subscriber to a remote queue follow the same failover
strategy of the master/slave, I did find that the JMS Bridge connector was a
viable solution since the broker would _not_ open the connection unless it
is the master.  And this met my requirement of having a single durable
subscriber of an external queue that is running within and feeding my active

   I've tabled this, as our project hasn't needed to implement this for
production in the near term.  But I'll have to reevaluate our solution if
ActiveMQ is intending to deprecate JMS Bridge connections.

   If you find anything useful (or an alternate solution) in your testing,
I'd appreciate your notes.


Stephen J wrote:
> Have you received an answer to this question or found a solution to your
> question?
> I am running into the same issue, and I'd like to know how to proceed with
> the configuration.
> I noticed you said it seems to work properly with the JMS bridge, which I
> saw in another message is being deprecated in favor of camel routing.
> If the camel routes are the way of the future I believe they will need to
> behave in the expected way in a master/slave configuration. Just as the
> way the JMS bridging works.
> Can someone "in the know" comment on this behavior?
> lsclark wrote:
>> 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.
>> activemq_remote.xml 
>> activemq_master.xml 
>> activemq_slave.xml 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message