A queue with multiple competing consumers IS a form of load balancing, so the
answer to what you are trying to do is probably simpler than you expect.
Refer to the  http://activemq.apache.org/clustering.html clustering  page.
Competing consumers on a queue will vie for messages, each taking up to the
prefetch limit, processing them, and acknowledging them back to the broker.
If the consumer dies having taken but not ack'd messages, they are
(eventually) thrown back onto the queue and can be taken by other consumers.
So probably you need only one queue, not several here. You can even leverage
affinity by using  http://activemq.apache.org/message-groups.html message
groups .

I'm not sure I understand your conern about "if a queue fails". The entire
broker would likely fail as a unit with its JVM and take all of its queues
with it. If by this you meant you want greater HA reliability, then you want
to be using some kind of master/slave broker cluster. If the master fails,
the slave will take over, picking up queues and topics in the same state the
master had when it failed. Producers and consumers would have to implement 
http://activemq.apache.org/failover-transport-reference.html failover  in
this case, which is easy. If you don't use master/slave, then when the JVM
running a broker with your queue dies, your persistent messages will still
be there when it comes back up, however long that takes, while your
non-persistent messages are lost.


geenee1019 wrote:
> 
> Hi,
> 
> Could anyone let me know how to do configure load balancing in Active
> MQ.... 
> 
> My requirement in For example if a queue has received 5 messages means the
> next 5 messages has to be routed to another queue and so on.... 
> 
> I was successfully able to achieve the failover scenario i.e if a queue
> fails, the message will be routed to other queue...Now I want to know
> about load balancing. 
> 
> 
> Thanks....
> 

-- 
View this message in context: 
http://www.nabble.com/Load-Balancing-in-ActiveMQ-tp24145146p24178063.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to