Best way to create REST API for long lasting tasks?

后端 未结 3 1472
春和景丽
春和景丽 2021-02-13 15:39

Suppose I have 2 servers.

The first is a service that provides some computations, which can last long time (minutes to hours).

The second server will use this s

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-13 15:57

    If you use Python, you can take advantage of RabbitMQ and Celery to do the job. Celery lets you create an item in a queue and then pause execution of whatever you're running it through (i.e.: Django) such that you can consume the output of the queue processor as it becomes available. No need for polling OR callbacks.

提交回复
热议问题