(Thank for http://permalink.gmane.org/gmane.comp.python.amqp.celery.user/1695)
To create a queue? You know celery automatically declares queues right?
You wouldn't 'create' a queue per se, you only declare them, in some context
the queue is only actually created when a message is delivered to it.
For some transports queues and exchanges *must* be declared by every
process that uses them.
If you use RabbitMQ then you can create a queue manually like this:
from celery import current_app as celery
from kombu import Queue, Exchange
q = Queue("foo", Exchange("foo", type="direct"), routing_key="foo")
with celery.broker_connection() as conn:
with conn.channel() as channel:
q(channel).declare()
Comments
Post a Comment