首页 > 解决方案 > 如何比较 Mono、Flux 中的相似数据

问题描述

我是响应 webclient 的新手,我有两个请求同时进行,但我需要比较两个响应数据。有任何想法吗?

标签: spring

解决方案


根据您的评论,我假设您想在 s 上使用某种zip运算符Mono。ReactorzipWith可以通过以下方式使用:

targetApex.zipWith(sourceApex).subscribe(apex-> {
    // apex is type of Tuple2 which has getT1 and getT2 methods
    int result = apex.getT1().compare(apex.getT2());
    // do something with the result
});

推荐阅读