Skip to content

Add documentation for Chained DataLoaders #196

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dondonz
Copy link
Member

@dondonz dondonz commented Jul 16, 2025

This is a new feature coming in v25.0, and is available via the preview version v25.0.beta-2

This is written taking into account feedback regarding the confusion of the batch window configuration

Copy link
Member

@andimarek andimarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments

```

### How do I enable Chained DataLoaders?
As this changes execution order, you must opt-in to Chained DataLoaders by setting key-value pairs in `GraphQLContext`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually recommend people to use the UnusualConfiguration option and not directly put stuff into the GraphQLContext. See https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/GraphQLUnusualConfiguration.java

I think we need todo a follow up PR to add this config there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will change this

A note for another PR - other documentation pages will need an update to use the central Configuration class

2. Provide a `ScheduledExecutorService` to GraphQL Java, with key `DataLoaderDispatchingContextKeys.DELAYED_DATA_LOADER_DISPATCHING_EXECUTOR_FACTORY` and value implementing `DelayedDataLoaderDispatcherExecutorFactory`

### What changed in GraphQL Java 25.0?
The DataFetcher in the example above, before version 25.0 would have caused execution to hang, because the first DataLoader ("name") was never dispatched.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first would dispatch, but not the second ("email")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad - will update

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

Successfully merging this pull request may close these issues.

2 participants