Called by pika when the connection to RabbitMQ is closed
        unexpectedly.

        Since it is unexpected, we will reconnect to RabbitMQ if it disconnects.

        :param pika.connection.Connection _: The closed connection object
        :param int reply_code: The server provided reply_code if given
        :param str reply_text: The server provided reply_text if given

def on_connection_closed(self, _, reply_code, reply_text):
        """Called by pika when the connection to RabbitMQ is closed
        unexpectedly.

        Since it is unexpected, we will reconnect to RabbitMQ if it disconnects.

        :param pika.connection.Connection _: The closed connection object
        :param int reply_code: The server provided reply_code if given
        :param str reply_text: The server provided reply_text if given
        """
        self._channel = None
        if self._closing:
            self._connection.ioloop.stop()
        else:
            logger.warning('Connection closed, reopening in 5 seconds: (%s) %s', reply_code, reply_text)
            self._connection.add_timeout(5, self.reconnect)