Purge queues with amqplib

Use amqplib


from amqplib import client_0_8 as amqp


# Create connection
conn = amqp.Connection(
    host="localhost:5672",
    userid="xxxxx",
    password="xxxxxxxxx"
    virtual_host="/",
    insist=False
)
chan = conn.channel()


# Get list of queues (list type)
#
# ex. list_queues = ['queue-1','queue2',....]
#
for queue in list_queues:
    chan.queue_purge(queue)


Preparation Data ( thk juacompe )
   
   sudo rabbitmqctl list_queues name > queues.py


   inside vim let's do 
      $s/^/"/  # for insert " infront of queue name
      $s/$/",/ # for insert ", infront of queue name
      fill queue=["xxxx for the first line


      then you will get something like this


      ----------------------------
      queues_list = ["xxxxx",
      "xxxxx",
      ...
      "xxxxx"]
      ----------------------------


   Bring your ipython and env up


      from queues import queues_list


   and do normal step above

Comments

Popular posts from this blog

Difference between apt-get update and apt-get dis-upgrade