API Composition

Problem

One of the common problem is to render a single UI Screen or section of a UI Screen which requires data from multiple microservices. If UI interacts with multiple microservices and aggregate or massage the data then it will increases the number of round trips and results in high latency & increase the complexity on UI.

Solution

API composition at server-side is the solution where one microservice interacts with other microservices and returns the composite data to the client.

Available Patterns

  • Aggregate Composition Pattern
    In Aggregate Composition pattern, aggregator service sends request to multiple services and respond only after getting the response from all the requested services.
  • Chained Composition Pattern
    It can be used when one request has dependencies on other services and synchronous communication is required. If possible, avoid Chain composition and in case, it is really required then use short chain operations.
  • Branch Composition Pattern
    It can be used in a complex scenario where an aggregator takes the request and send it into multiple services to perform their individual task where multiple services can implement other composition pattern as per their need.
Please share this

Leave a Reply