Cly*_*row 6 java spring project-reactor spring-webflux
嗨,我的代码如下所示:
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>>
}
Run Code Online (Sandbox Code Playgroud)
Flux<T>如何获得Flux<List<T>>?
小智 11
您应该使用.concatMapIterable或.flatMapIterable。
Flux#flatMapIterable是一个特殊的运算符,用于将表示为 Iterable 的项“展平”为 T 的反应流。
| 归档时间: |
|
| 查看次数: |
8184 次 |
| 最近记录: |