Many of Spring Reactor's APIs are not written in Kotlin


#1

When I was writing Spring Reactor with Kotlin, many APIs did not know how to write it.

for example:

Java:

Flux.just(“a”, “b”)
.zipWith(Flux.just(“c”, “d”), (s1, s2) -> String.format("%s-%s", s1, s2))
.subscribe(System.out::println);


#2

And what is your question?


#3

I suppose the question is about the lack of examples in Kotlin.
That is actually easy to solve – just paste the Java example in Kotlin code and IDEA will propose to convert it to Kotlin automatically.


#4

The API for Java and Kotlin is basically the same. The main difference it the syntax for lambda expressions. And there are some Kotlin specific factory functions to create a Flux or Mono in the form of extension functions. This is described in the Reactor Reference.