You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by yinghe0101 <yi...@yahoo.com> on 2008/11/11 20:40:23 UTC

gracefully stop ActiveMQ in a network of broker

hi, All,
first, I have a question. the setup I have is two pair of master/slave
running on different machines. 
When I use activemq-admin.bat stop --jmxurl to stop one master, what happens
to the pending message in the queue on this stopped broker?

I have a requirement that when we need to maintain the server that hosts a
broker, we want to stop one broker in a way that it first stops accepting
new messages, then it forwards its pending queue messages to the other
broker and when all the pending messages are forwarded. it will stop its
network connector. 

Is there any way to achieve the above? or I have to change the source to do
this.

Thank you.

best,
Ying 
-- 
View this message in context: http://www.nabble.com/gracefully-stop-ActiveMQ-in-a-network-of-broker-tp20446775p20446775.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: gracefully stop ActiveMQ in a network of broker

Posted by Bruce Snyder <br...@gmail.com>.
On Tue, Nov 11, 2008 at 2:07 PM, yinghe0101 <yi...@yahoo.com> wrote:
>
> hi Bruce,
> thanks for your info. I think I did not clearly explain my setup.
> I have masterBroker1/slaveBroker1 and masterBroker2/slaveBroker2 on
> different machines.
> Then my client( both producers and consumers) use
> failover://(tcp://masterBroker1,tcp://masterBroker2)
> I only use slaveBrokers for data replication.
> To answer you, the messages are persistent.
>
> The issue I have is when I need to do maintainence work on masterBroker1. I
> need to stop masterBroker1/slaveBroker1 and have masterBroker2/slaveBroker2
> still able to accept client.
> Suppose masterBroker1 have some pending messages in a queue before the
> shutdown, and I will not bring it backup again soon, i want all those
> pending messages being able to forward to masterBroker2 before masterBroker1
> stops, because those pending messages might be critical.
>
> In sum, i need a way to first notify masterBroker1 to stop accepting
> clients, then forward all its pending messages to the other masterBroker,
> then stop it. Is there a way to do this without modifying the code? or I
> have to change the stop in BrokerService, if I need to change the code, how
> do I know all the pending messages are forwarded?
>
> hope this clarify my question. I will appreciate your advice. thanks

Thanks, this definitely clarifies the situation. I assume you must
have a network of brokers defined between masterBroker1 and
masterBroker2, correct. If so, a network of brokers forwards messages
from broker-to-broker based on demand. So if there are not any
consumers on the queue on masterBroker2, the messages will not be
forwarded from masterBroker1 to masterBroker2. I don't think there's a
way to force the forwarding of messages from broker-to-broker, though
thinking about it, there are use cases for it.

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

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: gracefully stop ActiveMQ in a network of broker

Posted by yinghe0101 <yi...@yahoo.com>.
hi Bruce,
thanks for your info. I think I did not clearly explain my setup. 
I have masterBroker1/slaveBroker1 and masterBroker2/slaveBroker2 on
different machines.
Then my client( both producers and consumers) use
failover://(tcp://masterBroker1,tcp://masterBroker2)
I only use slaveBrokers for data replication. 
To answer you, the messages are persistent.

The issue I have is when I need to do maintainence work on masterBroker1. I
need to stop masterBroker1/slaveBroker1 and have masterBroker2/slaveBroker2
still able to accept client. 
Suppose masterBroker1 have some pending messages in a queue before the
shutdown, and I will not bring it backup again soon, i want all those
pending messages being able to forward to masterBroker2 before masterBroker1
stops, because those pending messages might be critical. 

In sum, i need a way to first notify masterBroker1 to stop accepting
clients, then forward all its pending messages to the other masterBroker,
then stop it. Is there a way to do this without modifying the code? or I
have to change the stop in BrokerService, if I need to change the code, how
do I know all the pending messages are forwarded?

hope this clarify my question. I will appreciate your advice. thanks

best,
ying

bsnyder wrote:
> 
> On Tue, Nov 11, 2008 at 12:40 PM, yinghe0101 <yi...@yahoo.com> wrote:
>>
>> hi, All,
>> first, I have a question. the setup I have is two pair of master/slave
>> running on different machines.
>> When I use activemq-admin.bat stop --jmxurl to stop one master, what
>> happens
>> to the pending message in the queue on this stopped broker?
>>
>> I have a requirement that when we need to maintain the server that hosts
>> a
>> broker, we want to stop one broker in a way that it first stops accepting
>> new messages, then it forwards its pending queue messages to the other
>> broker and when all the pending messages are forwarded. it will stop its
>> network connector.
>>
>> Is there any way to achieve the above? or I have to change the source to
>> do
>> this.
> 
> Per the master/slave doc on the ActiveMQ website
> (http://activemq.apache.org/masterslave.html#MasterSlave-HowPureMaster/Slaveworks):
> 
> 'The master broker will only respond to a client when a message
> exchange has been successfully passed to the slave. For example, a
> commit
> in a clients transaction will not complete until the master and the
> slave have processed the commit.'
> 
> I also have a question for you - are the messages persistent? If so,
> the messages will be persisted on both the master and the slave.
> 
> Just note that failback must be achieved manually as noted in the
> following doc:
> 
> http://activemq.apache.org/masterslave.html#MasterSlave-RecoveryingaMasterSlavetopology
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
> 
> Blog: http://bruceblog.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/gracefully-stop-ActiveMQ-in-a-network-of-broker-tp20446775p20448411.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: gracefully stop ActiveMQ in a network of broker

Posted by Bruce Snyder <br...@gmail.com>.
On Tue, Nov 11, 2008 at 12:40 PM, yinghe0101 <yi...@yahoo.com> wrote:
>
> hi, All,
> first, I have a question. the setup I have is two pair of master/slave
> running on different machines.
> When I use activemq-admin.bat stop --jmxurl to stop one master, what happens
> to the pending message in the queue on this stopped broker?
>
> I have a requirement that when we need to maintain the server that hosts a
> broker, we want to stop one broker in a way that it first stops accepting
> new messages, then it forwards its pending queue messages to the other
> broker and when all the pending messages are forwarded. it will stop its
> network connector.
>
> Is there any way to achieve the above? or I have to change the source to do
> this.

Per the master/slave doc on the ActiveMQ website
(http://activemq.apache.org/masterslave.html#MasterSlave-HowPureMaster/Slaveworks):

'The master broker will only respond to a client when a message
exchange has been successfully passed to the slave. For example, a
commit
in a clients transaction will not complete until the master and the
slave have processed the commit.'

I also have a question for you - are the messages persistent? If so,
the messages will be persisted on both the master and the slave.

Just note that failback must be achieved manually as noted in the
following doc:

http://activemq.apache.org/masterslave.html#MasterSlave-RecoveryingaMasterSlavetopology

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

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/