def on_connection_closed(self, connection, reply_code, reply_text):
        """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

        """

        self.lg("Closed Connection", 6)
        self.m_channel = None
        if self.m_closing:
            self.m_connection.ioloop.stop()
        else:
            self.lg("Connection closed, reopening in 5 seconds Reply(" + str(reply_code) + ") Text(" + str(reply_text) + ")", 0)

            self.m_connection.add_timeout(self.m_wait_interval, self.reconnect)
    # end of on_connection_closed
dataset/ETHPy150Open GetLevvel/message-simulator/src/rabbit_message_publisher.py/RabbitMessagePublisher.on_connection_closed/original