def connect(self):
        """This method connects to RabbitMQ, returning the connection handle.
        When the connection is established, the on_connection_open method
        will be invoked by pika.

        :rtype: pika.SelectConnection
        """
        _logger.info('Connecting to %s', self.AMQP_URL)
        while True:
            try:
                return adapters.AsyncioConnection(pika.URLParameters(self.AMQP_URL),
                                                  self.on_connection_open)
            except AMQPConnectionError:
                asyncio.sleep(1)