'This method is invoked 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 connection: The closed connection obj
: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, connection, reply_code, reply_text):

    self._channel = None
    if self._stopping:
        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._connection.ioloop.stop)
