Search code examples
pythonrabbitmqcelerycelery-task

How to consumer from a celery queue in a different app


I have the below code in my producer application for inserting API calls into my RabbitMQ using Celery.

celery.send_task('tasks.process_redox', (payload,), queue="redox_inbound")

I was wondering, what would the code look like to consume from that queue? I have the below but it isn't working, can't seem to find it in the

@celery.task()
def process_redox(payload):
  data = encrypter.decrypt(payload)
  print data
  return

Solution

  • You need to tell celery to watch that queue.

    app.conf.task_queues = (
        Queue('redox_inbound',    routing_key='default'),
    )
    

    http://docs.celeryproject.org/en/latest/userguide/routing.html#manual-routing