This document describes Celery 2.3. For development docs, go here.

celery.app.amqp

AMQ related functionality.

copyright:
  1. 2009 - 2011 by Ask Solem.
license:

BSD, see LICENSE for more details.

AMQP

class celery.app.amqp.AMQP(app)
BrokerConnection

Broker connection class used. Default is kombu.connection.BrokerConnection.

Consumer

The task consumer class used. Default is kombu.compat.Consumer.

ConsumerSet

The class used to consume from multiple queues using the same channel.

queues

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

Queues(queues)

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

Router(queues=None, create_missing=None)

Returns the current task router.

TaskConsumer(*args, **kwargs)

Returns consumer for a single task queue.

TaskPublisher(*args, **kwargs)

Returns publisher used to send tasks.

You should use app.send_task instead.

get_task_consumer(connection, queues=None, **kwargs)

Return consumer configured to consume from all known task queues.

get_default_queue()

Returns (queue_name, queue_options) tuple for the queue configured to be default (CELERY_DEFAULT_QUEUE).

Queues

class celery.app.amqp.Queues(queues)

Queue name⇒ declaration mapping.

Celery will consult this mapping to find the options for any queue by name.

Parameters:queues – Initial mapping.
add(queue, exchange=None, routing_key=None, exchange_type='direct', **options)

Add new queue.

Parameters:
  • queue – Name of the queue.
  • exchange – Name of the exchange.
  • routing_key – Binding key.
  • exchange_type – Type of exchange.
  • **options – Additional declaration options.
options(exchange, routing_key, exchange_type='direct', **options)

Creates new option mapping for queue, with required keys present.

format(indent=0, indent_first=True)

Format routing table into string for log dumps.

select_subset(wanted, create_missing=True)

Select subset of the currently defined queues.

Does not return anything: queues not in wanted will be discarded in-place.

Parameters:
  • wanted – List of wanted queue names.
  • create_missing – By default any unknown queues will be added automatically, but if disabled the occurrence of unknown queues in wanted will raise KeyError.
classmethod with_defaults(queues, default_exchange, default_exchange_type)

Alternate constructor that adds default exchange and exchange type information to queues that does not have any.

TaskPublisher

class celery.app.amqp.TaskPublisher(*args, **kwargs)
auto_declare = True
declare()
delay_task(task_name, task_args=None, task_kwargs=None, countdown=None, eta=None, task_id=None, taskset_id=None, expires=None, exchange=None, exchange_type=None, event_dispatcher=None, retry=None, retry_policy=None, queue=None, now=None, retries=0, chord=None, **kwargs)

Send task message.

retry = False
retry_policy = None

Previous topic

celery.app.task

Next topic

celery.app.defaults

This Page