You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by khandelwalanuj <kh...@gmail.com> on 2015/12/09 08:57:12 UTC

Proper way to stop ActiveMQ

Hi,

I am using /apache-activemq-5.11.1/bin/activemq.jar to start the ActiveMQ
broker. But while stopping the broker, I am observing that
BrokerService.stop() is not called. I want to know what should be the ideal
way to stop the ActiveMQ broker if we are using activemq.jar from downloaded
package ? 


Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Proper way to stop ActiveMQ

Posted by Tim Bain <tb...@alumni.duke.edu>.
Did you mean to say you're using apache-activemq-5.11.1/bin/activemq stop
to stop the broker?  I'm not sure what executing the command you gave
earlier would do (and I don't have a broker I can try it against right
now), but I wouldn't expect it to stop the broker.

You can add a shutdown hook to any Java program via
Runtime.addShutdownHook().  See
https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

Tim
My requirement :

I need to execute some code when I stop the broker. What is the best way to
do this ?

Thanks,
Anuj



--
View this message in context:
http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801p4704802.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Proper way to stop ActiveMQ

Posted by khandelwalanuj <kh...@gmail.com>.
I got it. Thanks

What I did: 
Created my own plugin which extends BrokerPluginSupport. By this I can
override start() and stop() methods. 

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801p4704882.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Proper way to stop ActiveMQ

Posted by lichtin <li...@yahoo.com>.
The broker itself (class BrokerService) offers a method

   void addShutdownHook(Runnable hook)



khandelwalanuj wrote
> My requirement : 
>  
> I need to execute some code when I stop the broker. What is the best way
> to do this ? 
> 
> Thanks,
> Anuj





--
View this message in context: http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801p4704857.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Proper way to stop ActiveMQ

Posted by khandelwalanuj <kh...@gmail.com>.
My requirement : 
 
I need to execute some code when I stop the broker. What is the best way to
do this ? 

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801p4704802.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Proper way to stop ActiveMQ

Posted by GeraldMagee <me...@gmail.com>.
Thanks for guiding this Proper way to stop ActiveMQ



-----
buy generic viagra  most preferable and affordable medicine for ED
--
View this message in context: http://activemq.2283324.n4.nabble.com/Proper-way-to-stop-ActiveMQ-tp4704801p4716361.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.