This document describes the current stable version of Celery (3.1). For development docs, go here.

celery.app.amqp

Sending and receiving messages using Kombu.

AMQP

class celery.app.amqp.AMQP(app)[source]
Connection

Broker connection class used. Default is kombu.Connection.

Consumer

Base Consumer class used. Default is kombu.compat.Consumer.

queues[source]

All currently defined task queues. (A Queues instance).

Queues(queues, create_missing=None, ha_policy=None, autoexchange=None)[source]

Create new Queues instance, using queue defaults from the current configuration.

Router(queues=None, create_missing=None)[source]

Return the current task router.

TaskConsumer[source]

Return consumer configured to consume from the queues we are configured for (app.amqp.queues.consume_from).

TaskProducer[source]

Return publisher used to send tasks.

You should use app.send_task instead.

flush_routes()[source]
default_queue[source]
default_exchange[source]
publisher_pool
router[source]
routes

Queues

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

Queue name⇒ declaration mapping.

Parameters:
  • 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(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:
  • 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)[source]
consume_from
deselect(exclude)[source]

Deselect queues so that they will not be consumed from.

Parameters:exclude – Names of queues to avoid consuming from. Can be iterable or string.
format(indent=0, indent_first=True)[source]

Format routing table into string for log dumps.

new_missing(name)[source]
select(include)[source]

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

Parameters:include – Names of queues to consume from. Can be iterable or string.
select_add(queue, **kwargs)[source]

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.

Parameters: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.

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

TaskPublisher

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

Deprecated version of TaskProducer.