예제 #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)