-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin Coroutines Support #393
Comments
I'm not sure that's how the implementation would work out. In general, it is more helpful to describe the ask rather than a solution. Also this overlaps with #406 and #407 while the title here is broad enough to cover all three. If you could please, edit the description to describe all the places where you'd like to see Kotlin support. I'm gong to close the other two issues as duplicates. If we need to create sub-tasks we will, but for the requirements I see no reason to have multiple issues. |
OK, I listed all of my thought and issues I found when creating the Spring GraphQl/Kotlin Coroutines example project: https://github.com/hantsy/spring-graphql-sample/blob/master/spring-graphql-rsocket-kotlin-co |
I am also facing |
@xmlking Call |
checking https://opensource.expediagroup.com/graphql-kotlin/docs/server/spring-server/spring-subscriptions |
@xmlking I have tried it in my example project, but it has some limitations, the generic flow in in Query/Mutation and flow in Subscription can't be used at the same time. |
I've created #954 to address the above. Note that since this issue was created, we've added annotated exception handler methods. Those are the preferred way to handle exceptions now, and would be covered by the change. |
Add Kotlin Coroutines specific support.
Kotlin Coroutines support as alternative type of the
CompletableFuture
in DataLoaderSimilar to the existing ReactorDataLoader(internal class in the Spring GraphQl) etc.
CoroutinesBatchLoader
andCoroutinesMappedBatchLoader
variants.All Controller(Data Fetchers) fun supports Kotlin Coroutines
Currently I encountered an issue when returning a
Flow
in a query data fetching. For example,Define the following Graphql schema.
When executing the following query.
I got the exception like this.
error message: Can't resolve value (/allPosts) : type mismatch error, expected type LIST
Reproducing the issue: https://github.com/hantsy/spring-graphql-sample/blob/master/spring-graphql-rsocket-kotlin-co
Support Flow as Subscription return type
In a Kotlin Coroutines project, I would like use a Flow instead of Flux/Publisher as Subscription return type, that make my codes look smooth, no mixes of Reactor API and Kotlin Coroutines API.
Currently I have to convert it back to a Reactor Flux to make it work.
The example codes: https://github.com/hantsy/spring-graphql-sample/blob/master/spring-graphql-rsocket-kotlin-co/src/main/kotlin/com/example/demo/Services.kt#L92
Spring GraphQl has built-in
ReactorBatchLoader
internally. I think it is possible to use the same approach to getFlow
support as a Subscription type.Kotlin Coroutine variant of
DataFetcherExceptionResolver
Provides a variant to return
suspend
orFlow
instead of the Reactor APIs.The text was updated successfully, but these errors were encountered: