Skip to content

Rewriting the AMQP routing options.

ask edited this page Aug 13, 2010 · 4 revisions

Status

Implemented in the master branch, on track for 1.0.

New naming scheme.

The default setup in the new scheme:


CELERY_QUEUES = {
    "celery": {                    # old AMQP_CONSUMER_QUEUE
        "exchange": "celery",      # old AMQP_EXCHANGE
        "exchange_type": "direct", # old AMQP_EXCHANGE_TYPE
        "binding_key": "celery",   # old AMQP_CONSUMER_ROUTING_KEY
    },
}
CELERY_DEFAULT_ROUTING_KEY = "celery" # old CELERY_PUBLISHER_ROUTING_KEY
CELERY_DEFAULT_QUEUE = "celery" # The default queue to use. (old: AMQP_CONSUMER_QUEUE)
CELERY_DEFAULT_EXCHANGE = "celery" # The default exchange to use.
CELERY_DEFAULT_EXCHANGE_TYPE = "direct" # Default exchange type.

If an entry in CELERY_QUEUES doesn’t contain an exchange or exchange_type,
then the defaults (CELERY_DEFAULT_EXCHANGE, CELERY_DEFAULT_EXCHANGE_TYPE)
is used in place.

Example custom setup

In this configuration we have two queues, one for tasks in general (default) and one for processing
RSS feeds (feeds). They both use the same exchange (tasks) of type topic.

By default all tasks are sent to the default queue with routing key tasks.tasks.



CELERY_DEFAULT_QUEUE = "default"
CELERY_DEFAULT_EXCHANGE = "tasks"
CELERY_DEFAULT_EXCHANGE_TYPE = "topic"
CELERY_DEFAULT_ROUTING_KEY = "tasks.task"

CELERY_QUEUES = {
    "default": {
        "binding_key": "tasks.#",
    },
    "feeds": {
        "binding_key": "feeds.#",
    },
}



Clone this wiki locally