On 06/14/2010 05:31 PM, Andrew Badr wrote:
Sorry if you get this message twice; launchpad sucks.
I have a long-running server processes that listen for new messages
from some changing set of rooms. I want to make sure that when I'm
done with a particular room, all the resources associated with it are
eventually freed. Here's what my Room init code does:
routing_key = 'rooms.' + self.id <http://self.id>
queue_name = routing_key + '::' + CYCLONE_ID
consumer_tag = 'room' + self.id <http://self.id>
queue = yield AMQP_CONNECTION.queue(consumer_tag)
msg = yield queue.get()
Note that the AMQP connection+channel are global. When the server
wants to forgot about a room, what do I have to do to ensure that all
resources will eventually be garbage collected? Does it suffice to
cancel the consumer? Do I have to close the TimeoutDeferredQueue?
Looking at the code in protocol.py, it looks like there might be no
way to make the channel forget about the queue. Am I reading that
correctly? If so, that means I would need a new channel for each room,
That's not just init code, right? I mean you're also processing messages.
Anyway, I think you want to call queue_delete like this (untested):
Mailing list: https://launchpad.net/~txamqp-user
Post to : email@example.com
Unsubscribe : https://launchpad.net/~txamqp-user
More help : https://help.launchpad.net/ListHelp