def connect(self):
"""This method connects to RabbitMQ via the Torando Connectoin Adapter, returning the
connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
"""
pi('connect')
if self._connecting:
print 'RabbitMQClient: Already connecting to RabbitMQ'
return
print 'RabbitMQClient: Connecting to RabbitMQ on localhost:5672, Object: %s' % (self,)
self._connecting = True
pp(self, 'CONNECT')
return pika.adapters.TornadoConnection(parameters=self._parameters,
on_open_callback=self.on_connection_opened,
stop_ioloop_on_close=False)
评论列表
文章目录