【问题标题】:How to consumer from a celery queue in a different app如何从不同应用程序中的芹菜队列中消费
【发布时间】:2017-12-20 03:27:48
【问题描述】:

我的生产者应用程序中有以下代码,用于使用 Celery 将 API 调用插入到我的 RabbitMQ。

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

我想知道,从该队列中使用的代码是什么样的?我有以下,但它不工作,似乎无法在

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

【问题讨论】:

    标签: python rabbitmq celery celery-task


    【解决方案1】:

    您需要告诉 celery 观看该队列。

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

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

    【讨论】:

      猜你喜欢
      • 2014-11-24
      • 2023-01-05
      • 1970-01-01
      • 1970-01-01
      • 2015-01-05
      • 1970-01-01
      • 2018-03-09
      • 2013-12-30
      • 2015-06-01
      相关资源
      最近更新 更多