activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <>
Subject Re: graceful ActiveMQ shutdown
Date Sun, 23 May 2010 15:31:30 GMT
On Sat, May 22, 2010 at 11:14 PM, Alex Harvey <> wrote:
> Hi all,
> I am new to ActiveMQ and afraid I'm a mere sysadmin without any knowledge of
> Java, beans, XML etc!
> I am using ActiveMQ 5.3.0.
> ARCHITECTURE: Two node network of brokers using multicast discovery:
> I created the network of brokers by making minor modifications to the
> activemq-dynamic1.xml and activemq-dynamic2.xml example network of brokers
> configuration files. By "minor modifications", I simply changed the
> transportConnectors so that both brokers listen on port 61616 (the example
> has one broker listening on 61618 so that the two brokers can run on the
> same physical host) and I copied the Jetty configuration for the admin
> console from the activemq-demo.xml file.
> That is, both nodes use
>        <transportConnectors>
>            <transportConnector name="openwire" uri="tcp://"
> discoveryUri="multicast://default" />
>        </transportConnectors>
> and
>        <networkConnectors>
>          <networkConnector uri="multicast://default"
>        </networkConnectors>
> In order to gracefully shutdown a broker (e.g. for system maintenance) it
> seems there is no natively supported graceful shutdown, so I have adopted
> the following method:
>        iptables -I INPUT 1 -p tcp --dport $PORT -j DROP
>        iptables -I INPUT 1 -s -p tcp --dport $PORT -j ACCEPT
>        rulesAdded=1
> Then I wait up to 1 minute for the Java consumers to drain all queues.
> If after 1 minute there a still queues with messages pending then I force
> shutdown using
>        /usr/local/apache-activemq-5.3.0/bin/activemq-admin stop
> After this is completed, the script removes the temporary firewall rules.
> Also, if someone issues CTRL-C to the stop script, the signal is trapped,
> and the two firewall rules are removed again.
> Do any of the ActiveMQ developers know if this method I've devised will
> actually work when it goes live? Unfortunately, the developers haven't
> written real consumers yet so there's no way of testing this!
> I am happy to share the scripts / config files if anyone wants to see them.

Based on the iptables rules above, it looks like the second rule
overrides the first rule, correct? I think the second rule accepts
request on the port only from local clients. If this is correct, I see
nothing wrong with it. And the call to activemq-admin stop is indeed a
safe way to shut down ActiveMQ.

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:

View raw message