Celery: apply_async wait for response

760 views Asked by At

There are two services running in my application (Srvice1, Servie2). A request is sent from the client to Service1 and Service1 calls a task as follows.

result = my_task.apply_async (kwargs = data)

And my_task calls an operation on server two:

@shared_task()
def my_task(** kwargs):
     return Server2.do_job(kwargs)
 
 

Similarly, Service2 performs a series of celery tasks and eventually has to return the output to Service1.

Question: How can I wait for the answer to be returned from server two?

I used result.get() to solve the problem but got no result.

0

There are 0 answers