Discussion on Microservices Integration
Microservices is a distributed system pattern and components need to communicate through the network.
If communication data includes internal technical details of participating components, the system loses the property of loose-coupling.
If a change in one service causes changes in many other services, we lose the property of high-cohesion.
An unreliable network and added latency for data communication dictate choices for services integration.
There are two major types:
- Direct Communication
- Event-based, asynchronous communication
Direct communication is a request/response-based. It is useful for low-latency and immediate consumption scenarios. It is prone to failures (server unresponsive, network latency) and hence caller/clients need to retry. This communication is not easily extensible and soon become brittle.
Asynchronous mode is a “fire and forget” approach. An event is generated and it is up to the consumers to handle it. This model scales very well: the publisher and consumers have no coupling. Both are independently deployable. However, it is hard to monitor the status of each event handler.
Written with StackEdit.