Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I tried to use DataLoaders in a Spring WebFlux application, all the APIs in the service/repositories returned a Mono/Flux, but there is no a DataLoader variant for these case.

You must be logged in to vote
        BatchLoader<String, Data> batchLoader =new BatchLoader<>() {
            @Override
            public CompletionStage<List<Data>> load(List<String> keys) {
                Mono<List<Data>> monoOfData = loadData(keys);
                CompletableFuture<List<Data>> cfOfData = monoOfData.toFuture();
                return cfOfData;
            }
        };

Monos can be made into CompletableFutures

Replies: 1 comment

Comment options

        BatchLoader<String, Data> batchLoader =new BatchLoader<>() {
            @Override
            public CompletionStage<List<Data>> load(List<String> keys) {
                Mono<List<Data>> monoOfData = loadData(keys);
                CompletableFuture<List<Data>> cfOfData = monoOfData.toFuture();
                return cfOfData;
            }
        };

Monos can be made into CompletableFutures

You must be logged in to vote
0 replies
Answer selected by hantsy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.