獲取Flux訂閱數量java
視頻講解:https://www.bilibili.com/video/av80322616/
FluxMonoTestCase.javareact
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分鐘視頻學習
api