【发布时间】:2020-12-08 20:16:03
【问题描述】:
我想在我的 Spring Boot 服务中将多个 Flux 结果收集到一个中。我的方法:
private Flux<VMachineResourceResponse> getDataForPhysicalMachineProtection(
ResourcesWrapper resources, UUID groupId) {
Flux<VMachineResourceResponse> result = Flux.empty();
resources
.getHypervResources()
.forEach(
resource -> {
Flux<VMachineResourceResponse> protectedResourcesForAgentAndId =
hypervAgentService.getProtectedResourcesForAgentAndId(
groupId, resource.getAgentId());
result.mergeWith(protectedResourcesForAgentAndId); //maybe that way???
});
return result;
}
怎么做?
【问题讨论】:
标签: java spring-boot reactive-programming spring-webflux