您好,我的代码如下所示:
fun mapBatch(batch: List<String>): Mono<List<MyClass>> ...
fun myFun(stream: Flux<String>): Flux<MyClass> {
return stream
.bufferTimeout(50, Duration.ofSeconds(60L))
.flatMap{ batch -> mapBatch(batch) }
/// now here I would like to get Flux<MyClass> but have Flux<List<MyClass>>
}如何从Flux<List<T>>获取Flux<T>?
发布于 2021-08-27 13:55:04
您应该使用.concatMapIterable或.flatMapIterable。
Flux#flatMapIterable是一个特殊的操作符,用于将表示为Iterable的项“扁平化”为T的反应流。
https://stackoverflow.com/questions/67972425
复制相似问题