I have a few queues running with RabbitMQ. A few of them are of no use now, how can I delete them? Unfortunately I had not set the auto_delete
option.
If I set it now, will it be deleted?
Is there a way to delete those queues now?
Uninstalling RabbitMQ Server and Erlang OTP Select Uninstall a program. Right-click RabbitMQ Server, and then click Uninstall. Repeat steps 1-3 to uninstall Erlang OTP 18. Note: This script will delete all files related to RabbitMQ on C:\.
if you want to remove the consumer programmatically, calling the cancel method on the RabbitMQ channel should do.
An auto-delete queue will be deleted when its last consumer is cancelled (e.g. using the basic. cancel in AMQP 0-9-1) or gone (closed channel or connection, or lost TCP connection with the server). If a queue never had any consumers, for instance, when all consumption happens using the basic.
If you do not care about the data in management database; i.e. users
, vhosts
, messages
etc., and neither about other queues
, then you can reset
via commandline by running the following commands in order:
WARNING: In addition to the queues, this will also remove any
users
andvhosts
, you have configured on your RabbitMQ server; and will delete any persistentmessages
rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl start_app
The rabbitmq documentation says that the reset
command:
Returns a RabbitMQ node to its virgin state.
Removes the node from any cluster it belongs to, removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages.
So, be careful using it.
import pika connection = pika.BlockingConnection(pika.ConnectionParameters( 'localhost')) channel = connection.channel() channel.queue_delete(queue='queue-name') connection.close()
Install pika package as follows
$ sudo pip install pika==0.9.8
The installation depends on pip and git-core packages, you may need to install them first.
On Ubuntu:
$ sudo apt-get install python-pip git-core
On Debian:
$ sudo apt-get install python-setuptools git-core $ sudo easy_install pip
On Windows: To install easy_install, run the MS Windows Installer for setuptools
> easy_install pip > pip install pika==0.9.8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With