Microservice communication

The subject of this book talks about communication between microservices. The best way to address this is in a practical way, and we will understand this communication as we develop our orchestrator_news_service microservice.

First, let's understand how we will apply the communication flow. To do this, let's observe the following diagram. The UI makes a request that passes through the Load Balancer and arrives at the NewOrchestrator, which is our microservice responsible for orchestrating the news data. After that, the orchestrator writes in the Message Broker (in our case, a RabbitMQ), a message saying what data types the UI has requested to be orchestrated.

Each News microservice knows exactly what kind of message it is; it is up to you to respond to it. The response process of microservices is very similar to that of the orchestrator, as it also writes a response message to the orchestrator who knows exactly where to read.

This process of exchanging messages is what the News microservices will communicate. At times, the communication will be via RPC, and, at other times, it is creating totally asynchronous and non-blocking events.

This communication behavior is already being used in our famous_news_service microservice. We will work with this type of communication when we use CQRS internally in the microservice, where we have both RPC to talk to other microservices directly and events when we are posting something new in the CommandStack database. The only difference is that now, we will take this communication model to the systemic level.

Take a look at the following illustration:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.143.103