#java#reactor#take#获取#
获取Flux订阅数量
视频讲解: https://www.bilibili.com/video/av80322616/
FluxMonoTestCase.java
package com.example.reactor; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import java.time.Duration; @Slf4j public class FluxMonoTestCase extends BaseTestCase { @Test public void take(){ //根据数量获取 Flux.range(1,10).take(0).log().subscribe(System.out::println); //根据实际获取 Flux.range(1,10000).take(Duration.ofMillis(2)).log().subscribe(System.out::println); //根据条件获取 Flux.range(1,10).takeUntil(item ->item == 5).log().subscribe(System.out::println); } }
关注公众号,坚持每天3分钟视频学习