Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete all of the topics in ActiveMQ?

Tags:

activemq

I'm using ActiveMQ with the C# client library. I created 10,000 topics with random names as part of a test for evaluation purposes and now I can't get rid of the topics. ActiveMQ grinds to a halt with this number of topics so I need them out of the system. Here is what I have tried so far, and none of it has worked. I'm running ActiveMQ as a Windows service.

  • Delete all of the files and folders in ACTIVEMQ_HOME\Data
  • Turn off all persistence
  • Delete all of the files and folders in the persistence folder
  • Delete the entire ACTIVEMQ_HOME directory and reinstall it in a different folder

I've traced the file activity and cannot find any file that is written to when a topic is created or deleted.

I realize that the .NET client library is a little light on functionality, so I can't even get a list of all the topics programmatically.

like image 729
Stefan Moser Avatar asked Mar 02 '09 18:03

Stefan Moser


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.

What is a topic in ActiveMQ?

What Is an ActiveMQ Topic? ActiveMQ topic is a pipeline of messages where a message comes in and goes to every subscriber.


2 Answers

Go to your broker configuration file, open the file for editing on the broker element, add the following attribute:

deleteAllMessagesOnStartup="true"

This will cause all previous topics & queues, and their pending messages to be deleted from your kaha store when you restart your broker.

Have Fun!

like image 74
NSA Avatar answered Oct 09 '22 02:10

NSA


This question might be old, but a quick and easy way to totally purge all data in ActiveMQ alongwith all queues and topics is to go to the following path:

<ActiveMQ_Installation_Directory>/data

And delete all files in that.

Now once you restart AMQ it will start as a fresh, clean install.

like image 31
Zoinks Avatar answered Oct 09 '22 00:10

Zoinks