springboot webflux flux 使用示例(聚合操作)
*************************
group
public class Test {
public static void main(String[] args){
Flux.just(1,2,3,4,5,6).groupBy(value -> value<3)
.subscribe(flux -> {
if (Objects.equals(flux.key(),Boolean.TRUE)){
System.out.print("key为"+flux.key()+"的个数为:");
flux.count().subscribe(System.out::println);
}
});
}
}
********************
控制台输出
key为true的个数为:2