I am building out a microservice architecture and kinda confused on one part. I am using Kafka as a message broker system to communicate within my services. A perfect example would be Uber's API for request estimation. It returns duration, distance, price, etc. I would assume they have a microservice for each of those, i.e. service for pricing, service for duration/distance, service for drivers, etc. My question is when hitting the endpoint /requests/estimate
does the requests microservice make rest calls to the other microservices to retrieve data for the duration, distance, etc? or does the API Gateway take care of that?
0
votes
All microservices should follow single entry point for all clients.As standard practice all endpoint i.e API or microservice should be under API Gateway and client should access it via API Gateway only.i.e if /requests/estimate requests to other microservices to retrieve data for the duration, distance then the other microservices are also under API GW.
– utpal416
3 Answers
0
votes
0
votes
0
votes
In practice, not all gateway APIs support multiple calls and aggregation. In the micro service architecture, there is a common pattern ("API Composition", "Composition Patterns" in particular "Aggregator Pattern"), the idea of which is that you need to make a separate service that will contain the business logic of multiple calls and aggregation.