不应该是2个吧,我看源代码应该是3个,初始化的时候建立了3个consumer,每一个consumer一个Queue,在nova.service.Service中的start()方法中: # Share this same connection for these Consumers self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=False) node_topic = '%s.%s' % (self.topic, self.host) self.conn.create_consumer(node_topic, rpc_dispatcher, fanout=False) self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=True) # Consume from all consumers in a thread self.conn.consume_in_thread()#把consumer放到绿色线程中,并且启动监听消息顺着create_consumer()就能找到队列了
self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=False) node_topic = '%s.%s' % (self.topic, self.host)
self.conn.create_consumer(node_topic, rpc_dispatcher, fanout=False) self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=True) # Consume from all consumers in a thread
self.conn.consume_in_thread()#把consumer放到绿色线程中,并且启动监听消息顺着create_consumer()就能找到队列了