celery -A proj report
in the issue.master
branch of Celery.software -> celery:3.1.0 (Cipater) kombu:3.0.37 py:2.7.10
billiard:3.3.0.23 py-amqp:1.4.9
platform -> system:Darwin arch:64bit imp:CPython
loader -> celery.loaders.default.Loader
settings -> transport:amqp results:redis://localhost:6379/0
CELERY_QUEUES:
(<unbound Queue Test_Queue -> <unbound Exchange test_exchange(topic)> -> myapp.tasks.some_tasks.#>,
<unbound Queue Test_Queue -> <unbound Exchange test_exchange(topic)> -> myapp.tasks.more_tasks.#>)
RABBITMQ_MANAGEMENT_URL: 'localhost:15672'
CELERY_IMPORTS:
('myapp.tasks.some_tasks', 'myapp.tasks.more_tasks')
CELERY_ROUTES:
(<myapp.routers.DefaultRouter object at 0x1077952d0>,)
BROKER_URL: 'amqp://guest:********@localhost:5672//'
CELERY_RESULT_BACKEND: 'redis://localhost:6379/0'
CELERY_QUEUES = (
Queue("Test_Queue", default_exchange, routing_key="myapp.tasks.some_tasks.#"),
Queue("Test_Queue", default_exchange, routing_key="myapp.tasks.more_tasks.#"),
)
myapp.tasks.some_tasks.#
celery amqp
queue.bind Test_Queue test_exchange Key1
queue.bind Test_Queue test_exchange Key2
CELERY_QUEUES is a mapping from queue_name to queue, so since you are defining two queues
with the same name, only one of them will be used.
To define a queue with multiple bindings in Kombu you should use:
from kombu import Exchange, Queue, binding
default_exchange = Exchange('default', type='direct')
CELERY_QUEUES = (
Queue('Test_Queue', [
binding(default_exchange, routing_key='myapp.tasks.some_tasks.#'),
binding(default_exchange, routing_key='myapp.tasks.more_tasks.#'),
]),
)
Great! Just tested it and both bindings have been instantiated. Is this worth adding to the routing docs? I can create a pull request sometime tonight or tomorrow
Sure! That would be a great idea to have it in the docs :)
Most helpful comment
CELERY_QUEUES is a mapping from queue_name to queue, so since you are defining two queues
with the same name, only one of them will be used.
To define a queue with multiple bindings in Kombu you should use: