Service Interactions

Checkout lesson on UDEMY Section preview

Microservices do not live in isolation. They interact using mutliple forms of communication.

Communication patterns

Distributed architecture uses Synchronous and Asynchronous communication mechanisms to manage the interactions between components. In the illustration, the components are using HTTP/Synchronous calls as well as AMQP/Asynchronous calls for service interactions.

distributed-architecture

One-to-one a.k.a. Single receiver

Refers to interaction between two components. These interactions may be carried out using:

  • Synchronous protocol such as HTTP/GRPC/RPC
  • Asynchronous messaging protocol such as AMQP. In the context of messaging this pattern is also known as point-to-point

One-to-Many a.k.a. Multi receiver

Messages are of interest to multiple components. In the context of messaging this pattern is also known as Publish-Subscribe or Pub-Sub pattern. In the illustration, when an Account is created a message is published on a topic. Subscriber of the topic receive the message asynchronously and carry out an appropriate action based on the desired business outcome.

pub-sub

Dependency management

You learned multiple patterns that are used for maintaining the independence between the bounded contexts. These patterns are applied irrespective of the communication pattern used for microservices interactions. The idea is to reduce the dependencies between interacting sevices.

  • Conformist
  • Client-Supplier
  • Anti-Corruption Layer
  • Shared Kernel
  • Partnership