Inter-service Communication

In MSA, it is recommend to use asynchronous interaction while communicating with microservices which is a hybrid version of the below mentioned Async communication styles:
  • Asynchronous communication, by using asynchronous HTTP polling where thread is not blocked as shown below
Message broker and event-based communication.
  • A given microservice can be the message producer and it can asynchronously send messages to a queue or topic. Then the consuming microservice can consume messages from the queue or topic.
Avoid Point-to-point Style or direct communication style where consumer service/application directly interact with microservice as it has the following drawbacks:
  • It can result in duplicating common functions and each microservice implementation can become complex because of those common functions.
  • It doesn’t provide central place to apply non-functional requirements, such as throttling, monitoring, tracing, or security needs to be applied at each service level.
  • Generally, the direct communication style is considered as a microservice anti-pattern for large-scale microservice implementations.
Please share this