How to do it correctly: GraphQL + Axon + Kotlin

Hi here!
I’m using Axon 4.5.9 in Kotlin Spring Boot web application. This application has a web layer which is accessible via GraphQL API (graphql-kotlin-spring-server 5.2.0) and inside code of Web endpoints call Axon with sendAndWait method.
As GraphQL API uses internally reactive non-blocking approach and sendAndWait is a synchonius one. Take a note that web service is implemented on Kotlin, who provides functionality of corutines.
So I’m woundering how to cook web endpoint correctly Kotlin(corutines) + GraphQL(reactive) + Axon(synchronous sendAndWait)?

Hi, having used (and contributed a bit) graphql-kotlin before without Axon, and having using Netflix dgs with Axon, I find this an interesting question.

In my experience, it’s better not to mix coroutines to muchwith code that’s not async in nature, as it can cause weird bugs if you aren’t careful. With that in mind I think it would be easiest to either use the Kotlin and/or reactive extension.

Alternatively you could maybe switch to either spring-graphql or Netflix DGS. But that might be a lot of work. I do have an example and recently wrote a whitepaper with some background.

I don’t have an example or experience using coroutines with Axon.