I am migrating my project from Spring to Ktor, and decided to replace the implementation of reactive streams which was initially Reactor to RxJava 2. Although I faced some problem when trying to combine multiple streams into single one at the end of the reactive pipeline. Here it is how it looks like:
internal interface Aggregator {
fun acquireSomethingFromSomewhere(keyword: String): Flowable<Some>
}
fun acquireSomething(keyword: String) = Flowable
.fromIterable(aggregators)
.map { it.acquireSomethingFromSomewhere(keyword) }
.flatMap { ??? }
The thing is, each call of acquireSomethingFromSomewhere
returns Flowable<Some>
, is there any operator which could help me combine them in the one stream at the end? In Reactor I just used:
fun acquireSomething(keyword: String) = Flux
.fromIterable(aggregators)
.map { it.acquireSomethingFromSomewhere(keyword) }
.flatMap { Flux.concat(it) }
But in RxJava I can't find any operator which could solve my problem, as each of them takes Publisher
as an argument, and Flowable
does not implement it.