activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Mielke <>
Subject Re: Questions about Networks of brokers and fail-over scenarios
Date Wed, 14 Mar 2012 11:04:33 GMT

please find answers inline.

On Mar 14, 2012, at 8:07 AM, pollotek wrote:

> Hi all,
> I am trying to set up a fault tolerant horizontaly scalable architecture
> with ActiveMQ servers. I see that I can setup a horizontally extensible
> ActiveMQ Network of Brokers by having the consumers connect to a random
> failover broker with something like this (say start with for 2 brokers):
> failover://(tcp://broker1:61000,tcp://broker2:61000)?randomize=true
> and on the brokers configure a bridge network connector as dynamicOnly and
> low network prefetchSize on bridge connectors pointing to each other to move
> the messages from one to another.
> Given a producer connected to /broker1 /queuing messages on a persistent
> queue and consumers attached to both brokers listening for messages for the
> same queue.
> If /broker1 /goes down the consumers pointing at /broker1 /will re-balance
> to read from broker2 and the producer will automatically point to /broker2/.
> - What happens to the persistent queue messages on /broker1 /that were not
> consumed yet? I guess the messages will sit on /broker1 /until it gets
> restarted and eventually get consumed, correct? I guess in this scenario we
> lose total ordering, correct?

Correct. Any messages on broker 1 that have not been forwarded will only be available when
broker 1 restarts. The ordering of messages is not guaranteed.
You may want to combine master/slave with broker networks so that each node in your broker
network is highly available. 
for documentation.

> - If I only had one producer queuing messages on /broker1 /and only a
> consumer on /broker2/. When will messages be forwarded to /broker2/? What if
> a new consumer connects to /broker1 /and tries to consume from the same
> queue? Will /broker2 /stop receiving messages because somebody is consuming
> them directly on /broker1/?

Messages get forwarded from broker1 to broker2 as soon as there are consumers on broker2.
If you connect another consumer to broker1 then both consumers get messages in round-robin
fashion. However you can configure your network bridge so that local consumers get higher
priority and msgs would get dispatched to local consumers first. 

> What if there was no failure and instead a new producer started queuing
> messages on the same queue on /broker2/. Given that there are consumers for
> this queue attached to both brokers would any of the messages be forwarded
> across the two brokers ? Would this happen only if one of the broker runs
> out of messages for the consumers and the other one still has messages?

By default msgs from both producers will get dispatched to both consumers in a round-robin
fashion. So messages cross the bridge. If you give local consumers higher priority, then msgs
would be dispatched locally as long as local consumers prefetch is not filled up fully. 

> I hope somebody can help me out to answer these very specific questions
> about these Network of Brokers fail-over scenarios

Hope this helps.

Torsten Mielke

View raw message