A start to #324 that provides a promise interface to executing querie#380
Conversation
|
One other thing on this PR. it brings the Java implementation inline with the reference JS one because the JS one returns a Promise of a ExecutionResult and so does this (CompletableFure is the Java promise) |
src/main/java/graphql/GraphQL.java
Outdated
There was a problem hiding this comment.
@bbakerman, normally "async" is preferred mainly due to pronunciation: https://english.stackexchange.com/questions/39743/abbreviation-of-asynchronous
src/main/java/graphql/GraphQL.java
Outdated
There was a problem hiding this comment.
Since I want to be able to .join() in a variety of places I think we should leave this as CompleteableFuture
|
As discussed, we will do it in version 4 |
src/main/java/graphql/GraphQL.java
Outdated
There was a problem hiding this comment.
do we wanna still provide this method or break it?
There was a problem hiding this comment.
I left it in to allow easier migration BUT I think we should break it
that is implementors of ExecutionStrategy are required to produce promises
We can keep the outer ones in place as "sugar" for people who just want a ExecutionResult direct
There was a problem hiding this comment.
yes, let us break the ExecutionStrategy but keep the blocking GraphQL.execute method.
There was a problem hiding this comment.
do we wanna still provide this method or break it?
There was a problem hiding this comment.
do we wanna still provide this method or break it?
|
looks good for me as a first step. |
|
Just a small nitpick: the naming (async vs asynch) is a bit hectic, and could use standardization. |
|
@kaqqao I agree. We should use |
|
This is the approach we will take with async support in graphql-java 4.0
|
4da4ef5 to
6af43b4
Compare
|
CompletableFuture should be CompletableStage |
|
@hepin1989 we decided to use |
Any serial execution is really an async one that is deemed complete so we are able to implement the existing via this pattern
This puts the structure in place to allow us to write truly asynchronous execution strategies where the consumer gets to decide when to consume the result.
As it turns out we can re-implement all the current serial execution strategies via the CompletableFuture pattern that have completed immediately. And hence this calls the async versions of everything to get work done.