Simulate a synchronous request on top of background async job with Flask Simulate a synchronous request on top of background async job with Flask flask flask

Simulate a synchronous request on top of background async job with Flask


So if I understand you correctly you want your backend to wait for the response from some worker (via RabbitMQ). You can achieve that by implementing rpc over rabbitmq. The key idea is to use the correlation id.

But definitely the most efficient way would be to run the client over websockets (or raw tcp socket if it is not a browser) and notify him directly when the job is done. That way you don't lock resources (client connection, rabbitmq queues) and you avoid performance hit (rpc).