January 2018
Intermediate to advanced
414 pages
10h 29m
English
Reactor provides a way to define a reactive publisher through a class named Mono, but that publisher can only send one result.
To create a Mono, we can simply do this:
val customerMono : Mono<Customer> = Mono.just(Customer(1, "Mono"))
But reactor provides a high-level function for Kotlin that we can use to take advantage of more Kotlin characteristics:
val customerMono : Mono<Customer> = Customer(1, "Mono").toMono()
But since Kotlin has type inference, we can simply write it as:
val customerMono = Customer(1, "Mono").toMono()
What we should understand is that a Mono is not actually the value of the Customer instance that we create, it is a promise of what we are going to get. When we declare something as Mono<Customer> ...
Read now
Unlock full access