Closed heycalmdown closed 5 years ago
Good question. Facing similar problem. Any updates?
Create the connection directly without using it as a context manager:
conn = rabbitpy.Connection(...)
Then pass that in your threads and create your channel in the thread.
I saved all my active queues (from different threads) and before closing the connection I cancel the consuming of these queue gracefully. This works pretty good for me.
I need multiple threads to consume multiple queues. Channels can not be shared through threads, so the each thread should make their own.
But because of
conn.close()
will delete its channels in the main thread, I'm getting several errors like by random;rabbitpy.exceptions.ChannelClosedException: Can not perform RPC requests on a closed channel, you must create a new channel
rabbitpy.exceptions.ConnectionClosed: The connection is closed
RuntimeError: dictionary changed size during iteration
Could you give me some advice how to handle multiple queues and close properly?