activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bwtaylor <>
Subject Re: Load Balancing in ActiveMQ
Date Wed, 24 Jun 2009 03:27:31 GMT

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 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 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 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:
Sent from the ActiveMQ - User mailing list archive at

View raw message