https://kotlinlang.org logo
Title
n

nimtiazm

06/15/2019, 1:23 AM
i’m trying to use a reactor enabled async library with kotlin coroutines. So far i’ve been able to provide
await()
extension for CompletableFuture and been able to use
Mono
results. What do I do for
Flux
results? How can the results be collected in a list asynchronously on a Publisher interface?
s

streetsofboston

06/15/2019, 3:59 AM
Would the use of Coroutines'
Flow
api work for you?
g

gildor

06/15/2019, 6:08 AM
Have you seen that kotlinx.coroutines has reactive streams adapter library? Maybe you need something like this: https://github.com/Kotlin/kotlinx.coroutines/blob/master/reactive/kotlinx-coroutines-reactive/src/Channel.kt#L24
There is no operator to collect all values of stream to list, but instead you can use: flux.collectList().await()