Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example with "Microservice" and DataLoader #43

Open
nilshartmann opened this issue Feb 6, 2023 · 2 comments
Open

Example with "Microservice" and DataLoader #43

nilshartmann opened this issue Feb 6, 2023 · 2 comments

Comments

@nilshartmann
Copy link
Collaborator

Hi @arey and all!

I created another variation of the spring-petclinic-graphql example, that I needed for trainings and other demonstrations.

This version uses a second backend "micro service" (for managing Vets) that can be used to demonstrate working of DataLoaders when collecting data for a GraphQL response from other remote services.

Everything else is almost the same as in our current example. Do you think I should merge the "new" example to this repository? I think it's a more realistic example with two backend services and it's also important to have a DataLoader example.

You can find my repo here: https://github.com/nilshartmann/spring-petclinic-graphql-microservice

If interessted, I would merge that back into this repo.

Thanks,
Nils

@arey
Copy link
Member

arey commented Feb 8, 2023

Hi Nils,
Thanks for sharing.
I didn't see how GraphQL DataLoader is working. That's done with your Youtube video. It could be interesting to add this feature in the https://github.com/spring-petclinic repo. Your readme references the original readme. Thus be careful with the merge. And what is the behavior of the backend when vet-service is down?
Regards
Antoine

@nilshartmann
Copy link
Collaborator Author

Hi @arey ,

And what is the behavior of the backend when vet-service is down?

Good question. Currently the GraphQL request would fail. That is an interessting problem in GraphQL APIs that are connected to multiple backend services in general. If you don't want the request to fail, you have to make all the data that comes from other services nullable in the schema and then send null as a result (or an explicit error type). At a later time it would maybe possible to use stream and defer for fields that are backed by a remote service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants