Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreUpdate: Kotlin is now natively supported by reactor-core
and reactor-test
without requiring any additional extensions.
I am excited to announce the release of the first milestone of Reactor Kotlin Extensions, which provides Kotlin extensions for Reactor API.
It provides support for Kotlin types like KClass
, takes advantage of Kotlin reified type parameters and provide various extensions to allow more expressive code. You can see bellow a quick comparaison of Reactor with Java versus Reactor with Kotlin + extensions.
Java | Kotlin with extensions |
---|---|
Mono.just("foo") |
"foo".toMono() |
Flux.fromIterable(list) |
list.toFlux() |
Mono.error(new RuntimeException()) |
RuntimeException().toMono() |
Flux.error(new RuntimeException()) |
RuntimeException().toFlux() |
flux.ofType(Foo.class) |
flux.ofType<Foo>() or flux.ofType(Foo::class) |
StepVerifier.create(flux).verifyComplete() |
flux.test().verifyComplete() |
To use it in your project, add https://repo.spring.io/milestone
repository and io.projectreactor:reactor-kotlin-extensions:1.0.0.M1
dependency.
This is the very first milestone, so feel free to create issues and submit pull requests on reactor-kotlin-extensions GitHub project.