Open ikhoon opened 3 years ago
I think it'd also be nice to re-use the Armeria executor that can be set in GraphqlService.builder().useBlockingTaskExecutor(boolean)
instead of the default GlobalScope
.
As the GraphQL Kotlin relies on GraphQL Java built on top of CompletableFuture
, it seems impossible to propagate a context to child fetcher at the moment.
Users can serve a graphql-kotlin service with
armeria-graphql
module. Becausegrpahql-kotlin
is made on top of graphql-java.graphql-kotiln
configurations could be converted into aGraphQLSchema
of graphql-java. https://github.com/line/armeria/blob/433c2ad91f008cfa90b164d893d2c2548632dd44/examples/graphql-kotlin/src/main/kotlin/example/armeria/server/graphql/kotlin/Main.kt#L40-L43But it has some drawbacks that do not fully leverage
graphql-kotlin
features. For example, we can not propagate a RequestContext through Kotlin's Coroutine scope. It should be nice to call the suspend endpoint function ofgraphql-kotlin
with Armeria's Coroutine dispatchers as we did in ArmeriaCoroutineUtil.kt https://github.com/ExpediaGroup/graphql-kotlin/blob/b02efbd9bd6b4598b55cdc713797a5c99af8bbae/servers/graphql-kotlin-server/src/main/kotlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt#L42 https://github.com/line/armeria/blob/61b80b39d4c0ed7599330606862ee4a1a9450c49/kotlin/src/main/kotlin/com/linecorp/armeria/internal/common/kotlin/ArmeriaCoroutineUtil.kt#L43-L51