Closed pdechery closed 1 year ago
Fell free to use connection.reconnect_callbacks in this case. https://github.com/mosquito/aio-pika/blob/master/aio_pika/robust_connection.py here it's calling.
Hi, thanks for the reply.
So, should I use the add
method in CallbackCollection class and pass any callable as argument?
Like so:
def my_callback():
pass
connect_robust.reconnect_callback.add(my_callback)
@pdechery i was implementing the reconnect callback, and it seems you need to pass a sender param to the callback function definition to make it work with aio-pika so it will look like
@staticmethod
def my_callback(sender):
pass
connect_robust.reconnect_callback.add(my_callback)
or if you need self
def my_callback(self, sender):
self.do_some_work()
pass
connect_robust.reconnect_callback.add(my_callback)
i think this issue should be closed, @mosquito
Hi, thanks for maintaining this package.
My project used version 6.3 and called the
on_reconnect_callback
method insiderobust_connect
I've migrated to the new version (8.3.0) and that method is gone. I've been searching how to have the same functionality on the new version but have found nothing so far. The documentation stops mentioning
on_reconnect_callback
from version 7.0 onwards.Browsing through the code I found a
CallbackCollection
object that's called insideRobustConnection
. It seems to be made with the purpose I'm looking for but documentation (or CHANGELOG) doesn't provide any information about how to use it.Can anyone give some guidance about that? Thanks a lot.