oslo_messaging与rabbitmq(1)

oslo_messaing通过kombu与rabbitmq建立channel连接,向rabbitmq中发送数据

在oslo_messaging/_drivers/impl_rabbit.py中,初始化self.connection,此时channel为None

在self.ensure_connection才真实初始化channel,self.ensure中self.connection.connect是建立连接,调用kombu中Connction的connect方法

connect方法见下,其在impl_rabbit.py为excute_method的method()方法,autoretry调用execute_method方法,在出现异常时,执行error_back:

 

 在kombu的connection方法中,使用self.transport的establish_connection

在建立连接时,from .transport import get_transport_cls, supports_librabbitmq,调用get_transport_cls,获取transport_cls建立client端

原文地址:https://www.cnblogs.com/CaesarLinsa/p/9868451.html