Skip to content

Releases: graphql-java/java-dataloader

2.1.1

28 Aug 07:31

Choose a tag to compare

This adds new features into data loader to allow you to write more powerful batch loading functions

The first is returning a Map from batch loader function instead of an ordered list. This suits some use cases much more naturally

        MappedBatchLoaderWithContext<Long, User> mapBatchLoader = new MappedBatchLoaderWithContext<Long, User>() {
            @Override
            public CompletionStage<Map<Long, User>> load(Set<Long> userIds, BatchLoaderEnvironment environment) {
                SecurityCtx callCtx = environment.getContext();
                return CompletableFuture.supplyAsync(() -> userManager.loadMapOfUsersByIds(callCtx, userIds));
            }
        };

        DataLoader<Long, User> userLoader = DataLoader.newMappedDataLoader(mapBatchLoader);

        // ...

The second major change is that context can now be pushed into batch loading functions allowing you to get user credentials or database details for example

        DataLoaderOptions options = DataLoaderOptions.newOptions()
                .setBatchLoaderContextProvider(() -> SecurityCtx.getCallingUserCtx());

        BatchLoaderWithContext<String, String> batchLoader = new BatchLoaderWithContext<String, String>() {
            @Override
            public CompletionStage<List<String>> load(List<String> keys, BatchLoaderEnvironment environment) {
                SecurityCtx callCtx = environment.getContext();
                return callDatabaseForResults(callCtx, keys);
            }
        };

        DataLoader<String, String> loader = DataLoader.newDataLoader(batchLoader, options);

2.1.0

28 Aug 07:28

Choose a tag to compare

This release is borked. DO NOT USE. Use 2.1.1 instead

2.0.2

04 Dec 10:56

Choose a tag to compare

  • This fixes a bug where calling load while caching is disabled means the batch loader should get duplicate batch calls.

  • Also the synchronized code policy was changed

2.0.1

20 Sep 21:09

Choose a tag to compare

  • Adds new statistics capability so you can track what is happening inside your data loaders

2.0.0

09 Sep 14:44

Choose a tag to compare

  • #9 - add Try support
  • This changes the DataLoader registry so its a named map of loaders
  • Removed the dependency on graphql-java
  • Removed the graphql dispatching Instrumentation (since it will be moved to graphql-java)

1.0.2

01 Sep 06:22

Choose a tag to compare

#5

  • There is now graphql Instrumentation support that ensures dataloader is dispatched as a graphql query executes

1.0.1

02 Aug 11:44

Choose a tag to compare

This is the first release of the pure Java 8 port of Facebook data loader

It has no dependencies on any library to make it as lightweight as possible.

https://github.com/graphql-java/java-dataloader

Enjoy