Skip to content Skip to sidebar Skip to footer

Start Celery Worker And Enable It For Broadcast Queue

I'm trying to start celery worker so it only listens to single queue. This is not a problem, I can do this that way: python -m celery worker -A my_module -Q my_queue -c 1 But now

Solution 1:

When using a broker for sending messages, client and workers must agree on same configuration values. If you have to change config, you need to purge existing messages and restart everything so that they are in sync.

When starting a broadcast queue you can set exchange type and configure the queue.

from kombu.common import Broadcast
from kombu import Exchange


exchange = Exchange('custom_exchange', type='fanout')

CELERY_QUEUES = (
    Broadcast(name='bcast', exchange=exchange),
)

Now you can start worker with

celery worker -l info -A tasks -Q bcast 

Post a Comment for "Start Celery Worker And Enable It For Broadcast Queue"