celery.app.amqp

Sending and receiving messages using Kombu.

AMQP

class celery.app.amqp.AMQP(app)[源代码]

  • Connection

Broker connection class used. Default is kombu.Connection. - Consumer

Base Consumer class used. Default is kombu.compat.Consumer. - queues[源代码]

All currently defined task queues. (A Queues instance). - Queues(queues, create_missing=None, ha_policy=None, autoexchange=None)[源代码]

Create new Queues instance, using queue defaults from the current configuration. - Router(queues=None, create_missing=None)[源代码]

Return the current task router. - TaskConsumer None[源代码]

Return consumer configured to consume from the queues we are configured for (app.amqp.queues.consume_from). - TaskProducer None[源代码]

Return publisher used to send tasks.

You should use app.send_task instead. - flush_routes()[源代码] - default_queue None[源代码] - default_exchange None[源代码] - publisher_pool None - router None[源代码] - routes None[源代码]

Queues

class celery.app.amqp.Queues(queues=None, default_exchange=None, create_missing=True, ha_policy=None, autoexchange=None)[源代码]

Queue name⇒ declaration mapping.

参数: - queues – Initial list/tuple or dict of queues. - create_missing – By default any unknown queues will be added automatically, but if disabled the occurrence of unknown queues in wanted will raise KeyError. - ha_policy – Default HA policy for queues with none set.

Add new queue.

The first argument can either be a kombu.Queue instance, or the name of a queue. If the former the rest of the keyword arguments are ignored, and options are simply taken from the queue instance.

参数: - queuekombu.Queue instance or name of the queue. - exchange – (if named) specifies exchange name. - routing_key – (if named) specifies binding key. - exchange_type – (if named) specifies type of exchange. - **options – (if named) Additional declaration options.
- add_compat(name, ***options*)[源代码]
- consume_from None[源代码]
- deselect(exclude)

Deselect queues so that they will not be consumed from.

参数: exclude – Names of queues to avoid consuming from. Can be iterable or string.
- format(indent=0, indent_first=True)[源代码]

Format routing table into string for log dumps. - new_missing(name)[源代码] - select(include)

Sets consume_from by selecting a subset of the currently defined queues.

参数: include – Names of queues to consume from. Can be iterable or string.
- select_add(queue, ***kwargs*)[源代码]

Add new task queue that will be consumed from even when a subset has been selected using the -Q option. - select_remove(exclude)[源代码]

Deselect queues so that they will not be consumed from.

参数: exclude – Names of queues to avoid consuming from. Can be iterable or string.
- select_subset(include)[源代码]

Sets consume_from by selecting a subset of the currently defined queues.

参数: include – Names of queues to consume from. Can be iterable or string.

TaskPublisher

class celery.app.amqp.TaskPublisher(channel=None, exchange=None, *args,* **kwargs*)[源代码]

Deprecated version of TaskProducer.