The onErrorResume operator

Similar to the OnErrorReturn operator, there is the OnErrorResume operator, which provides a fallback  value stream instead of a single fallback value. In the event of an error, the fallback stream is returned. The original error event is not propagated to the error callback. The event processing continues by using the configured event handler, as follows:

    @Test    public void testErrorResume() {        Flux<Long> fibonacciGenerator = Flux.generate(() -> Tuples.<Long,                Long>of(0L, 1L), (state, sink) -> {          // Removed for Brevity        });        fibonacciGenerator                .onErrorResume(x -> Flux.just(0L,-1L,-2L))                .subscribe(System.out::println);    }

In the preceding code, the following applies:

  1. The onErrorResume operator is used to provide back ...

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.