I'm trying to design an application that uses the microservices architecture. The service would have an api gateway, a user service and then a seperate service for each analytic source.
For example, lets say I had twitter analytics data and instagram analytics data. There would be a seperate microservice for twitter analytics data and instagram analytics data. These microservices would handle oauth for that service, storing data and pulling data. My question is this: how would I request data from one service, lets say the user service, and then based on data from the user service, make a request to the instagram service and twitter service to request analytics info for that user.
However what would happen if I had n
amount of services that I needed to request to? Like let's say a user needs analytics data from facebook, instagram, twitter and tiktok. How would I handle making a seperate request to each and then combine into a single response for the client?
I was thinking of using an api gateway as I've read that you can support request fanning-out to multiple microservices. I'm exactly sure how to do that however I found this article from aws outlining the different strategies.
I've also read over this question that says "You should implement endpoints in the services to facilitate these two requests. If you're making n requests, you've done it wrong"
. So now I'm not even sure if I'm on the right track.
Am I approaching this the correct way?