Monday, October 8, 2012

Clear QPid/Andes/Cassandra JMS Queues



This tutorial shows how to clear the JMS queues of Cassandra. It should be noted that this method clear all the queues; you can't clear queue of your selection. This is useful where you have sent a message, and while it's in the queue something went wrong. There could be errors in processing the message due to incorrect settings etc. Since the queues are accessed FIFO (First-In-First-Out), if a message is hanged in the queue, it'll also block all other messages in the queue because they waits until the first message is processed.

At WSO2, we use WSO2 Message Broker to connect with Cassandra via WSO2 Andes (extended version of QPid) while WSO2 ESB will utilize these to maximum use. Message Store and Message Processor mediators that comes with WSO2 ESB uses JMS queues extensively.


  • Shutdown all the servers if they are running
  • Open up Cassandra-HOME/conf/cassandra.yaml
  • Remember the log locations you have set. Typically, you would have set 
    • data_file_directories
    • commitlog_directory
    • saved_caches_directory
  • Delete all three files folders. (By default, these locations point to relevant child folder in Cassandra-HOME/logs/cassandra/)
It's all set. Now, start the cassandra and other servers. The queues will be cleaned. Actually, what  happens during this process is that it removes all the queues. When the servers start, they re-create the missing queues. That should be it! :)