activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harvey <>
Subject graceful ActiveMQ shutdown
Date Sun, 23 May 2010 05:14:29 GMT
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

            <transportConnector name="openwire" uri="tcp://"
discoveryUri="multicast://default" />


          <networkConnector uri="multicast://default"


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

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.

Many thanks,
Alex Harvey

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message