This repository was archived by the owner on Oct 25, 2021. It is now read-only.
On demand data loader registry#38
Closed
etienne-sf wants to merge 3 commits intographql-java:masterfrom
Closed
Conversation
Member
|
This project is now archived in favor of the official Spring GraphQL integration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
I'm building on the graphql-maven-plugin-project that is both a Maven and a Gradle plugin. It generates the code that allows to easily develop a java GraphQL client, or a GraphQL server (it just generated the code that allows to directly use graphql-java).
On server side, this plugin faces the issue that the DataLoader is loaded once. And so, the cache is global, and not per request.
This PR allows to have a per request dataloader cache.
Here are the updates contained in this PR:
OnDemandDataLoaderRegistryinterface. This interface allows to provide a Spring Bean that can provide a new DataLoaderRegistry each time itsgetNewDataLoaderRegistry()method is called.DefaultGraphQLInvocationbean, so that when aOnDemandDataLoaderRegistryis provided, itsgetNewDataLoaderRegistry()method is called for each request invocation. This allows to have a per_request dataloader cacheOf course, these updates are for both the webmvc and the webflux modules.
I also added the
javax.annotation-apidependency, as it is necessary to compile on my java version.Etienne