How to extract content of Mono and set to a variable in Kotlin?

Viewed 134

I have a function foo() that return Mono<String> I want to store the String output in a variable

e.g. -

fun foo(): Mono<String> {
   return Mono.just("Hello")
}

fun consumeFoo() : String {
   val result : String = // Set this variable to "Hello" by calling foo() 
}

In this case how to set result to string inside Mono in a non-blocking method ?

0 Answers
Related