Skip to content

Instantly share code, notes, and snippets.

@anubhavsinha
Created January 17, 2015 18:46
Show Gist options
  • Save anubhavsinha/60906c37555bcee2b83e to your computer and use it in GitHub Desktop.
Save anubhavsinha/60906c37555bcee2b83e to your computer and use it in GitHub Desktop.
purge a rabbitmq queue
from amqplib import client_0_8 as amqp
conn = amqp.Connection(host="mq.example.com:5672", userid="admin", password="p@ssw0rd!", virtual_host="/", insist=False)
conn = conn.channel()
queues = ['celery']
for q in queues:
if q:
#print 'deleting %s' % q
conn.queue_purge(q.strip())
print 'purged %d items' % len(queues)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment