Cloud-Native Applications in Java
上QQ阅读APP看书,第一时间看更新

Microservice aggregation

Aggregation at the business tier. In this approach, a microservice aggregates the responses from the various constituent microservices. This pattern is useful if there is any real-time business logic to be applied while aggregating data. For example, showing the total value of customer holdings across various businesses:

Benefits

The benefits of using the microservice aggregation pattern are as follows:

  • Finer control on the aggregation. Also, there is a possibility of incorporating the business logic based on aggregated data. Thus, offering richer content aggregation capabilities.
  • Lower dependency on API gateway capabilities.

Trade-offs

The trade-offs associated with the microservice aggregation pattern are as follows:

  • Lower latency and more code, as there is an additional hop introduced due to an additional step.
  • More chances of failure or making mistakes. Parallel aggregation from microservices will need sophisticated code such as reactive or call back mechanisms.