SubscribeOn operator

The subscribeOn operator intercepts events from a publisher in the execution chain and sends them to a different scheduler for the complete chain. It is important to note that the operator changes the execution context for the complete chain, unlike the publishOn operator, which only alters the execution of a downstream chain:

@Test    public void testReactorSubscribeOn() throws Exception{        Flux<Long> fibonacciGenerator = Flux.generate(() -> Tuples.<Long,                Long>of(0L, 1L), (state, sink) -> {            if (state.getT1() < 0)                sink.complete();            else      ;            print("Generating next of "+ state.getT2());            return Tuples.of(state.getT2(), state.getT1() + state.getT2());        });        fibonacciGenerator                                .filter(x -> { print("Executing ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.