Esempio n. 1
0
def channel_created(client):
    log.debug("%s to RabbitMQ is created" % client.channel)
    on_node_started(client)
    smanager = SubprocessManager(client)
    smanager.add_report(IFConfigReport, 30)
    smanager.add_report(BrctlShowReport, 300)
    smanager.add_report(DFReport, 300)
    smanager.start()
    heartbeat = PeriodicCallback(partial(on_node_started, client),
                                 15000)
    heartbeat.start()
    client.io_loop.add_timeout(time.time() + 15,
                               partial(vm_inventory, client))
Esempio n. 2
0
    def on_channel_created(self, channel):
        self.channel = channel
        frame = yield gen.Task(channel.queue_declare, 
                               exclusive=True, auto_delete=True) 
        self.rpc_queue = frame.method.queue

        yield gen.Task(channel.queue_bind,
                       exchange=options.rpc_exchange,
                       routing_key=self.oid,
                       queue=self.rpc_queue)

        log.debug("rpc_queue %s for node %s is created" % (
                self.rpc_queue, self.oid))

        self.channel.basic_consume(self.get_consumer_callback(self.rpc_queue),
                                   queue=self.rpc_queue)

        if self._on_channel_created:
            self._on_channel_created(self)
        else:
            on_node_started(self)