Skip to content

Commit 9ee08e7

Browse files
committed
Put through comments
1 parent b1f1c38 commit 9ee08e7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

documentation/batching.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,20 @@ DataFetcher<CompletableFuture<Object>> df1 = env -> {
387387
```
388388

389389
### How do I enable Chained DataLoaders?
390-
As this changes execution order, you must opt-in to Chained DataLoaders by setting key-value pairs in `GraphQLContext`.
390+
You must opt-in to Chained DataLoaders via `GraphQLUnusualConfiguration.DataloaderConfig`, as this may change order of dispatching.
391391

392-
1. Set `DataLoaderDispatchingContextKeys.ENABLE_DATA_LOADER_CHAINING` to `true` to enable Chained DataLoaders
393-
2. Provide a `ScheduledExecutorService` to GraphQL Java, with key `DataLoaderDispatchingContextKeys.DELAYED_DATA_LOADER_DISPATCHING_EXECUTOR_FACTORY` and value implementing `DelayedDataLoaderDispatcherExecutorFactory`
392+
1. Set `enableDataLoaderChaining(true)` to enable Chained DataLoaders
393+
2. Provide a `ScheduledExecutorService` to GraphQL Java, with method `delayedDataLoaderExecutorFactory` and a parameter that implements `DelayedDataLoaderDispatcherExecutorFactory`
394+
395+
For example
396+
```java
397+
GraphQL graphQL = GraphQL.unusualConfiguration(graphqlContext)
398+
.dataloaderConfig()
399+
.enableDataLoaderChaining(true);
400+
```
394401

395402
### What changed in GraphQL Java 25.0?
396-
The DataFetcher in the example above, before version 25.0 would have caused execution to hang, because the first DataLoader ("name") was never dispatched.
403+
The DataFetcher in the example above, before version 25.0 would have caused execution to hang, because the second DataLoader ("email") was never dispatched.
397404

398405
Prior to version 25.0, users of GraphQL Java needed to manually dispatch DataLoaders to ensure execution completed. From version 25.0, the GraphQL Java engine will automatically dispatch Chained DataLoaders.
399406

0 commit comments

Comments
 (0)