MCPcopy Create free account
hub / github.com/celery/celery / add_task_queue

Method add_task_queue

celery/worker/consumer/consumer.py:706–726  ·  view source on GitHub ↗
(self, queue, exchange=None, exchange_type=None,
                       routing_key=None, **options)

Source from the content-addressed store, hash-verified

704 self.hub.call_soon(self._flush_events_promise)
705
706 def add_task_queue(self, queue, exchange=None, exchange_type=None,
707 routing_key=None, **options):
708 cset = self.task_consumer
709 queues = self.app.amqp.queues
710 # Must use in' here, as __missing__ will automatically
711 # create queues when :setting:`task_create_missing_queues` is enabled.
712 # (Issue #1079)
713 if queue in queues:
714 q = queues.select_add(queues[queue])
715 else:
716 exchange = queue if exchange is None else exchange
717 exchange_type = ('direct' if exchange_type is None
718 else exchange_type)
719 q = queues.select_add(queue,
720 exchange=exchange,
721 exchange_type=exchange_type,
722 routing_key=routing_key, **options)
723 if not cset.consuming_from(queue):
724 cset.add_queue(q)
725 cset.consume()
726 info('Started consuming from %s', queue)
727
728 def cancel_task_queue(self, queue):
729 info('Canceling queue %s', queue)

Calls 5

infoFunction · 0.85
select_addMethod · 0.80
consuming_fromMethod · 0.80
add_queueMethod · 0.80
consumeMethod · 0.80