Open MDHD99 opened 2 months ago
You don't have a strong reference to queue
, so it gets Garbage Collected and when it is time to .restore()
the queues it is no longer in the relevant weakset.
QueueIterator keeps a strong reference to its queue.
Edit: https://github.com/mosquito/aio-pika/commit/663807cc41c1b9c956610b20c8013b3917337a86 is the first commit after the 9.0.7 release.
I'm also hitting this, but even in 9.0.7
, no more messages are getting through after a broker restart.
As a workaround I'm now using .consume()
. But keep in mind you need to hold a reference to the Channel
& Queue
object to prevent hitting #594
There seems to be a change in the way
RobustQueue.consume()
works when used in connection pooling scenarios in version9.4.1
(latest atm). TheRobustChannel
and the declaredRobustQueue
seem to be getting restored, but the consumers inside the declared queue are not getting restored after a broker restart.Here is an example to reproduce:
publisher.py
consumer.py
In the above example, the consumption will not get restored after a broker restart, but if we use an older version fe.
9.0.7
it seems to work fine.!!! Additional Notes!!!
RobustQueueIterator
seems to solve the issue in both versions (9.0.7
andlatest
). Replaceawait queue.consume(process_message)
with:But I am not sure whether or not to switch to this approach since it is not mentioned in the docs what the difference is between using
RobustQueueIterator
, and between using simplyRobustQueue.consume()
to handle incoming messagesrabbitmq:3.8-management-alpine