webflux HelloQuery.java
pokebadgerswithspoon opened this issue · 3 comments
pokebadgerswithspoon commented
Hello.
Is there a way to make query resolver to return a Mono?
oliemansm commented
That’s already supported. Have you tried...?
Groeten,
Michiel
…________________________________
Van: Lauri <notifications@github.com>
Verzonden: Saturday, February 29, 2020 2:23:57 PM
Aan: graphql-java-kickstart/samples <samples@noreply.github.com>
CC: Subscribed <subscribed@noreply.github.com>
Onderwerp: [graphql-java-kickstart/samples] webflux HelloQuery.java (#3)
Hello.
https://github.com/graphql-java-kickstart/samples/blob/acc70ff69d4776456fd148cb0513a8f2617dbc32/spring-boot-webflux/src/main/java/webflux/HelloQuery.java
Is there a way to make query resolver to return a Mono?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#3?email_source=notifications&email_token=ADHEKQESTF3WDV52PW5FRFLRFEF63A5CNFSM4K6W7KQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IRLY5GA>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADHEKQHIOKNQP4H3LPY4RKTRFEF63ANCNFSM4K6W7KQA>.
pokebadgerswithspoon commented
Yes, but with strange result.
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@Component
class HelloQuery implements GraphQLQueryResolver {
public Mono<String> hello() {
return Mono.just("Hello world. This is webflux");
}
}
This results in
"data": {
"hello": "MonoJust"
}
pokebadgerswithspoon commented
Thanks for update: 054492d#diff-4ec276d100cf531becadd23fecb2575c
Now I get it, the ingredient was to convert Mono to CompletableFuture, it works indeed.