Skip to content
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

Create an optional Kotlin module #1

Open
zambrovski opened this issue Sep 17, 2020 · 4 comments
Open

Create an optional Kotlin module #1

zambrovski opened this issue Sep 17, 2020 · 4 comments

Comments

@zambrovski
Copy link

The new Spring reactive way is Reactor + Kotlin Coroutines (with suspend functions). This allows for sequential composition of functions working on reactive streams.

I would suggest to create an additional Kotlin module, which allows for usage of reified types in query and command gateways and allow for usage of suspend functions instead of chains of flatMap calls on Mono and Flux.

Let us synchronize with extension-kotlin which part goes where.

@smcvb
Copy link
Member

smcvb commented Sep 18, 2020

Just to understand your stance on the matter @zambrovski, you mean an extension which basis itself on both the reactor and kotlin extension, adding additional features for this combination?

@zambrovski
Copy link
Author

Not necessary. I think inside of the Kotlin Module there should be a JAR for reactive extensions.

I believe Kotlin extension should go for coroutines by default, but if you want to use it with Reactor, the reactive extension can be just leveraged.

Using Kotlin reified classes you can skip the specification of the classes every time... I’ll share some code on that...

@smcvb
Copy link
Member

smcvb commented Sep 21, 2020

Gotcha, thanks for specifying further @zambrovski.

@jnfeinstein
Copy link

I agree with @zambrovski that extension-kotlin would ideally provide coroutine-based implementations of gateways, similar to how extension-reactor provides publisher-based implementations, and vanilla axon provides future-based implementations. The callback pattern used here is not one I've seen used in server-side code.

That said, I do not think it is high priority. extension-reactor is perfect for working with Spring WebFlux. I have not found coroutine support to be stellar across the ecosystem, and to my knowledge they are not supported at all by spring-security authorization annotations. JetBrains provides first-party support for interacting with publishers here and here. These work seamlessly with extension-reactor, allowing you to write suspending wrappers with syntax that you prefer. I also enjoy how easy and obvious it is to explicitly await or not await a result, which is one of my primary critiques with the suspend syntax.

There are many places throughout the Axon framework where reified types would be helpful. Gateways, repositories, fixtures, you could have an entire extension module of just reified wrapper functions. 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants