Tobias
08/23/2021, 6:03 PMgraphql-kotlin
together with a webserver called Armeria that has support for graphql-java (and an example for graphql-kotlin). The problem is that there is no way to get the RequestContext
in suspend functions, nor to use the Dispatchers provided by Armeria in an easy way. I've solved it by extending and overriding methods in FunctionDataFetcher
. It seems that runSuspendingFunction
has parameters for at least CoroutineContext
, so does that mean there are plans for greater configurability? E.g. by allowing the specification of a CoroutineContext
in the constructor of FunctionDataFetcher
or something similar?
I doubt the problem is unique to Armeria, since I can't figure out how to pass the context through to suspending methods without byte-code instrumenting graphql-kotlin runtime?RequestContext
is available through a wrapped ThreadLocal, but has extensions to invoke suspend functions, turning the RequestContext into a context element.Dariusz Kuc
08/23/2021, 6:11 PMgraphql-java
execution logic, we are constrained with what we can do with Coroutines due to the graphql-java
dependency on CompletableFuture
FunctionDataFetcher
that incorporates that logicrunSuspendingFunction
in your custom data fetcher so it reads stuff from armeria contextTobias
08/23/2021, 6:25 PMrunSuspendingFunction
Dariusz Kuc
08/23/2021, 6:30 PMTobias
08/23/2021, 6:31 PMDariusz Kuc
08/23/2021, 6:31 PMJoe
08/23/2021, 6:31 PMTobias
08/23/2021, 6:32 PMDariusz Kuc
08/23/2021, 6:45 PMTobias
08/23/2021, 6:50 PM