Asynchronous calls
In microservice architectures, asynchronous calls play a fundamental role when a process that used to be performed in a single application now implicates several microservices.
Asynchronous calls can be as simple as a separate thread or process within a microservice app, that's getting some work to be done and perform it without interfering with the HTTP request-responses round trips that are happening at the same time.
But doing everything directly from the same Python process is not very robust. What happens if the process crashes and gets restarted? How do we scale background tasks if they are built like that?
It's much more reliable to send a message that gets picked by another program, and let the microservice focus on its primary goal, which is to serve responses to clients.
In the previous chapter, we looked at how Celery could be used to build a microservice that gets some work from a message broker like Redis or RabbitMQ. In that design, the Celery worker blocks until...