graphql-dotnet / examples

Examples for GraphQL.NET
https://graphql-dotnet.github.io
MIT License
266 stars 186 forks source link

Calling REST multiple services #96

Open patolax opened 2 years ago

patolax commented 2 years ago

I have a microservice architecture with several REST services and dedicated databases for each service. I want to create a report that consist of data from multiple services. Can this lib be used for this case. Scenario Car service list all cars and order history list all orders for each car. Report shown below should list all recent 10 order against all the cars in the cars db.

image image

Question:

  1. In the scheme how do I resolve orders? is it best to call the orders rest endpoint directly or use the database repository as the source.
  2. can this approach handle 10,000 cars and history?
  3. Is there an example of similar implementation I can use?
sungam3r commented 2 years ago

The short answer ia YES.

  1. You can call any code in your resolvers, including, of course, the code that makes the calls to some databases.
  2. Why not? It depends of your needs and database performance.
  3. In this repository - NO, but you can ask on StackOverflow or search in Google since your questions are very general.