【问题标题】:Can we use celery as a message consumer (not producer) and distributor?我们可以使用 celery 作为消息消费者(而不是生产者)和分发者吗?
【发布时间】:2018-07-08 10:00:13
【问题描述】:

使用celery,是否可以使用RabbitMQ 监听新消息并安排工作人员进行处理?

很多celery documentation 是关于将其用作具有代理(例如RabbitMQ)的任务生产者,您在其中执行任务,它将通过代理传递。

我想使用来自代理的消息(由其他服务生成)并使用celery 处理消息。

【问题讨论】:

  • 我不使用 Celery,但据我了解,Celery 是消费者,这是其成为... 目的的一部分

标签: rabbitmq celery message-queue task-queue


【解决方案1】:

是的。您所要做的就是以 celery 将其识别为任务的方式配置放入 rabbitMQ 的消息。我已经使用 Nifi 完成了这项工作。我目前使用json,消息如下:

{"expires": null, "utc": true, "args": ["${absolute.path}${filename}", "nifihost"], "chord": null, "callbacks": null, "errbacks": null, "taskset": null, "id": "${uuid}", "retries": 0, "task": "taskmanager.tasks.nifi", "timelimit": [null, null], "eta": null, "kwargs": {}}

我不是 100% 肯定除了“任务”关键字之外还需要哪些关键字。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多