In monolithic systems, many projects fail to be successful in the move to microservices architecture just because of problems in the communication layer. Of course, when we talk about containers, distributed applications, and business domain partitioning, some terms may amaze you—these terms are latency and data translation.
Communication in a monolithic application is made up of internal components, such as methods, functions, attributes, and parameters. In this ecosystem, latency and data translation are irrelevant. In the world of microservices, they are topics that must be thoroughly analyzed.
There are two methods of communication between microservices:
- Synchronous
- Asynchronous
It is important to understand how each of these forms works. Let's see how:
One-to-One |
One-to-Many |
|
Synchronous |
Request/response |
- |
Asynchronous |
Notification |
Publish/subscribe |
Request/async response |
Publish/async responses |
Â
Have a look at the preceding table; the type of communication adopted will vary according to the need of the domain. For direct and sequential systems, a synchronous communication approach may be more appropriate. In the case of tasks that do not need an immediate response, the asynchronous approach can be the most appropriate.