Synchronous microservice communication
To exchange some information between microservices, they need to be able to talk to each other. In microservice communication, we mostly use two main patterns to establish communication between microservices. They are Synchronous Communication (sync) and Asynchronous Communication (async).
Sync is the easiest of the two communication patterns.
When one microservice needs information from another, it makes a direct request and waits for an answer before moving forward. The communication by itself is simpler and more reliable. It is just a function or method call if you compare it to a monolith application)
Here’s a breakdown of the steps:
- The calling microservice sends a message to another microservice.
- The calling microservice pauses its work and waits for a reply.
- The other microservice processes the request and sends a response back.
- Once the calling microservice has received the response, it can continue...