# Background process with callback

**URL:** <https://discuss.ray.io/t/background-process-with-callback/12749>\
**Category:** Ray Serve\
**Created:** [November 7, 2023, 11:54pm UTC](https://discuss.ray.io/t/background-process-with-callback/12749 "2023-11-07T23:54:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maris\_Basha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/maris_basha/32/5306_2.png) [@Maris\_Basha](https://discuss.ray.io/u/Maris_Basha)\
**Post date:** [November 7, 2023, 11:54pm UTC](https://discuss.ray.io/t/background-process-with-callback/12749/1 "2023-11-07T23:54:40Z")

</div>

Hello, I am running a ray serve with multiple replicas and dynamic batching.  
Sometimes my service needs more than 10+ minutes to run and having the client wait for the response is not optimal. Is there a way I can acknowledge the request, process the model in the background, and at the end send the results to a callback URL without having to use FastAPI or similar?

---

<div class="post-metadata">

**Author:** ![shrekris](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@shrekris](https://discuss.ray.io/u/shrekris)\
**Post date:** [November 8, 2023, 12:10am UTC](https://discuss.ray.io/t/background-process-with-callback/12749/2 "2023-11-08T00:10:39Z")

</div>

Hi @Maris_Basha, welcome to the forums!

This pattern can be handled using async requests. Serve doesn’t provide this natively yet, but we’re collecting community feedback on this feature through [this RFC](https://github.com/ray-project/ray/issues/32292). Please take a look and chime in with your thoughts!

For now, Ray Serve developers often rely on an additional task queue like [Celery](https://docs.celeryq.dev/en/stable/) to queue up their users’ requests and responses. In these systems, typically the request lifecycle is:

1. Submit a request, which gets queued on the task queue. The user gets a response immediately.
2. In the background the request gets processed. The result gets placed on a response queue.
3. The user polls the server periodically to see if the request has finished. Once it’s finished, the user gets a result.

---

<div class="post-metadata">

**Author:** ![seandavi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/seandavi/32/6123_2.png) [@seandavi](https://discuss.ray.io/u/seandavi)\
**Post date:** [May 13, 2024, 11:26pm UTC](https://discuss.ray.io/t/background-process-with-callback/12749/3 "2024-05-13T23:26:49Z")

</div>

Apologies for picking up this thread after such a long hiatus.

Just out of curiosity, is there a reason to adopt something like Celery when it seems like a ray task (or the newer “workflow”) would do the trick?
