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:
- The onErrorResume operator is used to provide back ...