コード例 #1
0
ファイル: mclient.py プロジェクト: dmitriko/swarm
    def on_channel_created(self, channel):

        AMQPClient.on_channel_created(self, channel)

        yield gen.Task(channel.exchange_declare,
                       exchange=options.rpc_exchange, 
                       exchange_type='topic')
        yield gen.Task(channel.exchange_declare,
                       exchange=options.reports_exchange, 
                       exchange_type='topic')
        yield gen.Task(channel.queue_declare, queue=options.reports_queue)

        log.debug("Exchanges for Manager are declared")

        yield gen.Task(channel.queue_bind,
                       queue=options.reports_queue, 
                       exchange=options.reports_exchange,
                       routing_key='#')

        log.debug("reports queue %s is bound" % options.reports_queue)

        self.channel.basic_consume(
            consumer_callback=self.get_consumer_callback(options.reports_queue),
            queue=options.reports_queue,
            no_ack=False)
コード例 #2
0
ファイル: nclient.py プロジェクト: dmitriko/swarm
 def __init__(self, *args, **kw):
     AMQPClient.__init__(self, *args, **kw)
     self.reports_to_send = Queue()
     self._on_channel_crated = kw.pop('on_channel_created', None)