ask/celery — pull request #577 by akipom (2011-12-26 12:59:28+00:00)
Title: [feature] Supports some user defined options on missing queue creation.

Adds an ability to specify some queue and exchange parameters when creating missing queue.
This is useful when using custom routing class (specified by CELERY_ROUTES) which decides a destination at runtime.

BACKGROUND:
My project is separated to many sub-projects, and they need to invoke tasks each other. All workers and clients(task senders) of each project does not know other project's queue definition at start, but the custom router class detects available routings at runtime using memcahe, and sends tasks to a appropriate queue with specific exchanges and routing keys.

Unfortunately, current implementation of expand_destination() uses queue name as exchange and routing key when creating missing queue.
But I want to use specific exchange and queue parameters (such as x-message-ttl, x-ha-policy of RabbitMQ) defined in other workers, so I've patched celery/routes.py to use user defined options if they were specified.
These parameters are provided by route_for_task function of custom router class (by lookup_route()), so this patch does not affects standard use cases.