def on_channel_open(self, channel):
        """This method is invoked by pika when the channel has been opened.
        The channel object is passed in so we can make use of it.

        Since the channel is now open, we'll declare the exchange to use.

        :param pika.channel.Channel channel: The channel object

        """
        self.lg("Channel opened", 6)
        self.m_channel = channel
        self.add_on_channel_close_callback()

        delete_existing_queues  = self.m_teardown_old
        only_if_queue_is_empty  = True
        delete_existing_exch    = self.m_teardown_old
        only_if_exchange_unused = True

        # build up the entities:
                    
        # If this is a specialized Publisher that only needs to publish
        if self.m_only_publishing:
            self.lg("Worker Starting Publish", 6)
            self.start_publishing()

        else:

            # If the Simulation JSON Model defines: ["Simulation"]["ResetAll"] == true
            # then this will tear down any previous existing Simulation Entities
            if self.m_teardown_old:
                reset_results       = self.____reset_cluster_entities({})

            self.lg("Creating Exchanges(" + str(len(self.m_exchanges)) + ")", 6)
            for exchange_node in self.m_exchanges:

                # clean up existing exchanges
                test_for_exchange   = self.get_exchange_details(exchange_node, delete_existing_exch, only_if_exchange_unused)
                if self.m_teardown_old:
                    if test_for_exchange["Status"] == "SUCCESS":
                        if test_for_exchange["Error"] == "Found Exchange":
                            self.delete_exchange(exchange_node)
                    else:
                        self.lg("ERROR: Failed to Cleanup Exchange(" + str(json.dumps(exchange_node)) + ") Results(" + str(test_for_exchange) + ")", 0)
                    
                    self.setup_exchange(exchange_node)
                else:
                    if test_for_exchange["Status"] == "SUCCESS":
                        if test_for_exchange["Error"] != "Found Exchange":
                            self.setup_exchange(exchange_node)
            # end of for all exchanges

            self.lg("Creating Queues(" + str(len(self.m_queues)) + ")", 6)
            for queue_node in self.m_queues:
        
                # clean up existing queues
                test_for_queue      = self.get_queue_details(queue_node, delete_existing_queues, only_if_queue_is_empty)
                if self.m_teardown_old:
                    if test_for_queue["Status"] == "SUCCESS":
                        if test_for_queue["Error"] == "Found Queue":
                            self.delete_queue(queue_node)
                    else:
                        self.lg("ERROR: Failed to Cleanup Queue(" + str(json.dumps(queue_node)) + ") Results(" + str(test_for_queue) + ")", 0)

                    self.setup_queue(queue_node)
                else:
                    if test_for_queue["Status"] == "SUCCESS":
                        if test_for_queue["Error"] != "Found Queue":
                            self.setup_queue(queue_node)
            # end of for all queues

            self.lg("Creating Bindings(" + str(len(self.m_bindings)) + ")", 6)
            for binding_node in self.m_bindings:
                self.lg("Binding Ex(" + str(binding_node["Exchange"]) + ") => Queue(" + str(binding_node["Queue"]) + ") RoutingKey(" + str(binding_node["RoutingKey"]) + ")", 6)
                self.m_channel.queue_bind(self.on_bindok, str(binding_node["Queue"]), str(binding_node["Exchange"]), str(binding_node["RoutingKey"]))
            # end of for all bindings
            
            # Allow Simulations to only create Consumers without creating Queues
            if len(self.m_queues) == 0:
                self.start_consumers()
            # end of starting consumers without any queues

        # end of if we are publishing 

    # end of on_channel_open
dataset/ETHPy150Open GetLevvel/message-simulator/src/rabbit_message_publisher.py/RabbitMessagePublisher.on_channel_open/original