def channel_opened()

in rabbitmq/management/commands/run_rabbitmq_responder.py [0:0]


    def channel_opened(self, connection):
        """
        async callback that is invoked when the connection is ready.
        it is used to connect up the channels
        :param connection: rabbitmq connection
        :return:
        """
        from rabbitmq.mappings import EXCHANGE_MAPPINGS
        logger.info("Connection opened")
        for i in range(0, len(EXCHANGE_MAPPINGS)):
            # partial adjusts the argument list, adding the args here onto the _start_ of the list
            # so the args are (exchange, handler, channel) not (channel, exchange, handler)
            durable_flag = EXCHANGE_MAPPINGS[i]["durable"] if "durable" in EXCHANGE_MAPPINGS[i] else False

            chl = connection.channel(on_open_callback=partial(Command.connect_channel,
                                                        EXCHANGE_MAPPINGS[i]["exchange"],
                                                        EXCHANGE_MAPPINGS[i]["handler"],
                                                              durable=durable_flag),
                                    )
            chl.add_on_close_callback(self.channel_closed)
            chl.add_on_cancel_callback(self.channel_closed)