Creating a Celery worker using node.js

前端 未结 2 504
清酒与你
清酒与你 2020-12-29 03:57

Using node-celery, we can enable node to push Celery jobs to the task queue. How can we allow node to be a Celery worker and consume the queue?

2条回答
  •  春和景丽
    2020-12-29 04:14

    Here is an approach from the Celery doc, by exposing REST api:

    http://docs.celeryproject.org/en/latest/faq.html#is-celery-multilingual

    Also, there’s another way to be language-independent, and that’s to use REST tasks, instead of your tasks being functions, they’re URLs. With this information you can even create simple web servers that enable preloading of code. Simply expose an endpoint that performs an operation, and create a task that just performs an HTTP request to that endpoint.

    some example: http://ask.github.io/celery/cookbook/remote-tasks.html

提交回复
热议问题