How do I limit the events currently being processed in a flatMap process?
问题 Given the following piece of code public static void main(String[] args) { long start = System.currentTimeMillis(); Flux.<Long>generate(s -> s.next(System.currentTimeMillis() - start)) .flatMap(DemoApp::delayedAction) .doOnNext(l -> System.out.println(l + " -- " + (System.currentTimeMillis() - start))) .blockLast(Duration.ofSeconds(3)); } private static Publisher<? extends Long> delayedAction(Long l) { return Mono.just(l).delayElement(Duration.ofSeconds(1)); } One can see from the output that