【发布时间】:2021-09-09 22:24:42
【问题描述】:
请参阅下面代码的 cmets 部分中嵌入的我的问题 -
// This should return a list of all ids and their name and status info, e.g. as json
public Mono<ServerResponse> f1(String originalId) {
// this gives list of ids which are comma separated
Mono<String> ids = f2(originalId);
ids.flatMapIterable(line -> Arrays.asList(line.split(COMMA)))
.doOnNext(id -> {
Mono<String> idName = f3(id);
Mono<String> idStatus = f4(id);
Mono<Tuple2<String, String>> combined = Mono.zip(idName, idStatus);
// How do i return all the combined Mono tuples as Mono<ServerResponse>
}).subscribe();
// Need to return proper Mono - not empty
return Mono.empty();
}
我也不确定是否应该返回 Flux 或 Mono 作为 f1() 的返回类型作为它的 id 列表及其各自的值
【问题讨论】:
标签: spring-boot spring-webflux reactor