Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ - delete/purge all queue via command line

Is there a way to delete / purge all queues in ActiveMQ via the command line (win/linux)? I could only find the commands for a specific queue. Or maybe there's a way to do this via the activeMQ admin? Again, I only found how to delete/purge the queues one by one, which can be very tedious.

Thanks!

like image 517
Ayelet Avatar asked Dec 03 '14 12:12

Ayelet


People also ask

What is purge in ActiveMQ?

The ActiveMQ or activemq-admin script in ActiveMQ provides the functionality to purge messages from the ActiveMQ queue. The script is located under $DX_HOME/message-broker/bin directory. Purge is the option which is to be used to delete the messages from the destination queue.

How do I purge JMS queue?

In the JMS Modules table, click the name of JMS module that contains the queue you want to delete. In the module's Summary of Resources table, select the check box next to the queue that you want to delete. Click Delete and confirm the deletion.


1 Answers

You can do tweak your activemq.xml a bit:

<broker deleteAllMessagesOnStartup="true"  ...>

This works with KahaDB message stores (it has problems with JDBC message stores), all your messages get deleted and subsequently queues are cleared.

As you want all queues to be deleted, restarting the broker won't be a costly option to clean everything up.

The purge will happen on 'every' restart

like image 190
Vihar Avatar answered Sep 18 '22 14:09

Vihar