[rabbitmq-discuss] pika 0.9.5 - trouble closing a connection?

Darren anon5874 at yahoo.com
Mon Jun 18 11:49:54 BST 2012


Not sure if this is user error or not, but I am opening a blocking 
connection:

        self.credentials = pika.PlainCredentials(settings.BROKER_USERNAME, 
settings.BROKER_PASSWORD)
        self.connection = 
pika.BlockingConnection(pika.ConnectionParameters(host=settings.BROKER_HOSTNAME, 
port=settings.BROKER_PORT, credentials=self.credentials))
        self.channel = self.connection.channel()
        self.callback_queue = self.channel.queue_declare().method.queue

and I try to close it like this:
        self.channel.queue_delete(queue=self.callback_queue)
        self.connection.close()

However, as seen from Rabbit MQ management console, the connection.close() 
method deletes the channels, but NOT the connection?
Now, the close method calls: BaseConnection.close(self, code, text)
which calls:
        for channel_number in self._channels.keys():
            self._channels[channel_number].close(code, text) # this closes 
the channel

        # If we already dont have any channels, close out
        if not self._channels:
            self._on_close_ready() # never gets here?

If instead, I have:
        self.connection.close()
        self.connection._on_close_ready()

then everything shuts down ok?










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120618/f8eec2c9/attachment.htm>


More information about the rabbitmq-discuss mailing list