Hot and Cold Publishers in Project Reactor
class ReactiveJavaTutorial { public static void main(String[] args) throws InterruptedException { Flux<String> netFlux = Flux.fromStream(ReactiveJavaTutorial::getVideo) .delayElements(Duration.ofSeconds(2)); // each part will play for 2 seconds // First Subscriber netFlux.subscribe(part -> System.out.println(“Subscriber 1: ” + part)); // wait 5 seconds before next Subscriber joins Thread.sleep(5000); // Seconds Subscriber netFlux.subscribe(part -> System.out.println(“Subscriber 2: ” + part)); Thread.sleep(60000); }…
Read More Hot and Cold Publishers in Project Reactor