We want to show alternate of a product like most of the e-commerce websites does. In our case, we need to fetch data from multiple microservices.
- Products - Stores all product information
- Prices - In our case prices are complex and subject to user's location and other parameters. Hence we made it a separate microservice.
- Reviews - It manages ratings and reviews about a product.
The end product will be List<AlternateProduct>
which would have an image, description, rating out of 5 and a number of reviews.
In microservice architecture, what is the right place to compose a response from multiple microservices?
Approatch 1:
- MVC/Rest API approaches APIGateway
- API Gateway make an async call to all microservices
- The response will be returned to MVC/WebAPI. Where the composition of response can be performed.
Approatch 2:
- MVC/Rest API approaches APIGateway
- API Gateway make an async call to Products microservice.
- Products microservice will call other microservice and perform composition and returns
List<UlternateProduct>
Please help me decide!