activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <bruce.sny...@gmail.com>
Subject Re: Kaha persistance -
Date Fri, 12 Nov 2010 16:42:36 GMT
On Fri, Nov 12, 2010 at 4:01 PM, Neil Pritchard
<Neil.Pritchard@securetrading.com> wrote:
> I'm running a network of brokers on three different boxes (xml config below) using kaha
for persistence.  I will need to take one of the brokers out of the network and decommission
the hardware permanently, it will be replaced with new hardware at a later date.  Each box
has a producer and consumer of it's own.  The consumers have to wait for a sub process to
finish before acknowledging each message and only consume one message at a time form any of
the brokers.  The Idea is that if the consumer is busy or has crashed, a consumer on one
of the other boxes will pick up the message and process it, a sort of load balancing and redundancy.
>
> Assuming unacknowledged messages are kept in the kaha persistence store on the broker
on which they are sent to; how can I be sure that they have been replicated on one of the
networked brokers and kept in the other brokers persistence store before the box is switched
off ?

Messages are not replicated throughout the network of brokers, they
are only moved if there is demand for the messages (i.e., a consumer).
The only way to decommission a broker is to manually move the messages
off of it and onto another broker. This can be done by using a
consumer to drain the messages on one broker and then publish them to
another broker in the network.

I have done this in the past using some simple Camel routing. Here's
an example just off the top of my head of what I did, I may be
forgetting some of the details:

...
<bean id="brokerA"
class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp:/hostA:21212"/>
</bean>

<bean id="brokerB"
class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="brokerURL" value="tcp:/hostB:21212"/>
</bean>

<from uri="brokerA:TEST.FOO" />
<to uri="brokerB:TEST.FOO" />
...

Some catches to this example:

* With these two Camel routes, messages are consumed from the TEST.FOO
queue on brokerA to the TEST.FOO queue on brokerB. If you have more
queues you will need routes for each of them as well.

* These routes do not handle topics. In my situation, I was only
dealing with a handful of queues. The problem with topics are
subscribers who have gone offline.

* You need to prevent any new messages from being published on brokerA
while it's being decommissioned. One way to do this is to disable the
transport connector being used by the producers and use a different
transport connector that employs a different port than the one used by
the producers. In the example, I used port 21212 instead of the
standard 61616. There is no transport connector on that port that is
automatically available, you will need to manually add that transport
connector to the broker.

This example is very rudimentary and will probably need to be improved
to handle other use cases.

YMMV

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder

Mime
View raw message