This document describes the current stable version of Celery (4.0). For development docs, go here.
Sending/Receiving Messages (Kombu integration).
AMQP¶
-
class
celery.app.amqp.
AMQP
(app)[source]¶ App AMQP API: app.amqp.
-
Connection
¶ Broker connection class used. Default is
kombu.Connection
.
-
Consumer
¶ Base Consumer class used. Default is
kombu.Consumer
.
-
Producer
¶ Base Producer class used. Default is
kombu.Producer
.
-
producer_pool
¶
-
routes
¶
-
Queues¶
-
class
celery.app.amqp.
Queues
(queues=None, default_exchange=None, create_missing=True, ha_policy=None, autoexchange=None, max_priority=None, default_routing_key=None)[source]¶ Queue name⇒ declaration mapping.
Parameters: - queues (Iterable) – Initial list/tuple or dict of queues.
- create_missing (bool) – By default any unknown queues will be
added automatically, but if this flag is disabled the occurrence
of unknown queues in wanted will raise
KeyError
. - ha_policy (Sequence, str) – Default HA policy for queues with none set.
- max_priority (int) – Default x-max-priority for queues with none set.
-
add
(queue, **kwargs)[source]¶ 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.Parameters: - queue (kombu.Queue, str) – Queue to add.
- exchange (kombu.Exchange, str) – if queue is str, specifies exchange name.
- routing_key (str) – if queue is str, specifies binding key.
- exchange_type (str) – if queue is str, specifies type of exchange.
- **options (Any) – Additional declaration options used when queue is a str.
-
consume_from
¶
-
deselect
(exclude)[source]¶ Deselect queues so that they won’t be consumed from.
Parameters: exclude (Sequence[str], str) – Names of queues to avoid consuming from.
-
select
(include)[source]¶ Select a subset of currently defined queues to consume from.
Parameters: include (Sequence[str], str) – Names of queues to consume from.
-
select_add
(queue, **kwargs)[source]¶ Add new task queue that’ll be consumed from.
The queue will be active even when a subset has been selected using the
celery worker -Q
option.