[rabbitmq-discuss] Durable queue disappears

Dmitriy Samovskiy dmitriy.samovskiy at cohesiveft.com
Wed Sep 10 21:18:03 BST 2008


Hi all,

I came across a strange situation, and can't see what I am doing wrong.

If you run the script below (uses py-amqplib) without a basic_consume call, a queue still 
exists in rabbit_amqqueue:stat_all() output after the script exits. However, if you run 
the same script with basic_consume call, a queue will exist in stat_all output while the 
script is running, but will disappear after the script exits.

This is with rabbitmq-server 1.4.0 on debian. During this test, there are no messages 
published to amq.direct with "bar" routing key.


#!/usr/bin/python2.5


import sys
from time import sleep, time
import amqplib.client_0_8 as rabbit

q = "foo%d" % int(time())

conn = rabbit.Connection("127.0.0.1", "guest", "guest")
ch = conn.channel()

ch.queue_declare(queue=q, durable=True)
ch.queue_bind(q, "amq.direct", "bar")

# if we do not start consumer, queue will remain after conn close - good
# if we do start consumer, queue will be gone - why?
#ch.basic_consume(q, callback=str)

print "stat_all will now have %s queue" % q
print "Ctrl+C to quit"

try:
   while True: sleep(100)
except KeyboardInterrupt: pass

ch.close()
conn.close()

print "Now do stat_all - %s is missing if consumer was started" % q







More information about the rabbitmq-discuss mailing list