failover is all about choosing and reconnecting.

so it chooses (maybe randomly) a url from the list and uses it till it fails.
On a failure,  it tries to reconnect using another (possibly random)
entry from the list
and keeps trying to reconnect till it exceeds a configured number of
retries or succeeds.
When it reconnects, it replays the connection id,
sessions/consumers/producers etc so that the client is unaware.

If you want to use both brokers all of the time, you need to have two
listeners or two connection factories in mule.


On 23 August 2012 15:03, crazysoumya <soumya_...@yahoo.co.in> wrote:
> I have an issue with ActiveMQ loadbalancing with Mule. I am using Mule 3.2.0
> and ActiveMQ 5.5.1
>
> I have a Mule FLow application which uses JMS inbound Endpoint to listen to
> queues in ActiveMQ. I have 2 instances of AMQ running each having a queue
> called "MyQueue". Lets name them AMQ1 and AMQ2. I also have 2 mule instances
> running - each having the same app. Let's name them Mule1 and Mule2.
>
> Now I want each mule instance to pick up messages from either of the AMQ
> queues. So say a Message Sender sends the message to the queue MyQueue in
> either AMQ1 or AMQ2 (Message sender load balances using failover transport
> supported by ActiveMQ - and that bit works fine). Say it reached AMQ1. Now
> ideally I would like to have 10 consumers each of Mule1 and Mule2 registered
> in each AMQ instance. So both of them are listening for incoming messages in
> both the queues. One of them should pick up the message from the queue and
> process it.
>
> This is the config I am using in Mule to connect to both the AMQ brokers.
>
>   <jms:activemq-connector name="Active_MQ"
> brokerURL="failover:tcp://10.0.64.158:61616,tcp://10.0.64.160:61616)?randomize=true"
> eagerConsumer="true" numberOfConsumers="10" dynamicNotification="true"
> validateConnections="true" clientId="MuleInstance1"  doc:name="Active MQ">
>       <reconnect count="5" frequency="3000" blocking="false"/>
>
>   </jms:activemq-connector>
> kindly note clientId is different for different Mule instances. Also
> currently AMQ 1 and Mule1 share the same machine and AMQ2 and Mule2 share
> another machine.
>
> However I am noticing soem random behaviour. AT times all consumers(both of
> Mule1 and Mule2) register only to one AMQ instance. At times Mule1 is
> registering only to AMQ1 and Mule 2 to AMQ2. What ideally I want is
> cosnumers of both Mule1 and Mule2 to register to both AM1 and AMQ2 I
> followed the instructions here
> http://www.mulesoft.org/documentation-3.2/display/MULE3USER/ActiveMQ+Integration
>
> Basically I wanted to use the network of broker architecture so that there
> is no loss of service whether a Mule instance or AMQ instance goes down or
> has to be restarted. Not sure the randomize=true query param in helping in
> this case.
>
> Can someone kindly advise how to achieve the above using Mule 3.2.0 and
> Active MQ 5.5.1?
>
> If there isn't a solution sadly I may have to make Mule1 listen to AMQ1 and
> Mule2 listen to only AMQ2 and it won't really be clustered :(
>
> Thanks in advance.
>
>
>
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/ActiveMQ-loadbalancing-in-Mule-ESB-tp4655481.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Reply via email to