@Test public void timeOutWithRetry() { Flux<String> colors = Flux.just("red", "black", "tan"); Flux<String> results = workshop.timeOutWithRetry(colors); StepVerifier.create(results).expectNext("processed red", "default", "processed tan").verifyComplete(); }
public Flux<String> timeOutWithRetry(Flux<String> colors) { return colors.concatMap(color -> simulateRemoteCall(color) .timeout(Duration.ofMillis(400)) .doOnError(s -> log.info(s.getMessage())) .retry(2).onErrorReturn("default")).log(); }
Part04HandlingErrors { public Flux<String> timeOutWithRetry(Flux<String> colors) { return colors.concatMap(color -> simulateRemoteCall(color) .timeout(Duration.ofMillis(400)) .doOnError(s -> log.info(s.getMessage())) .retry(2).onErrorReturn("default")).log(); } }
Part04HandlingErrors { public Flux<String> timeOutWithRetry(Flux<String> colors) { return colors.concatMap(color -> simulateRemoteCall(color) .timeout(Duration.ofMillis(400)) .doOnError(s -> log.info(s.getMessage())) .retry(2).onErrorReturn("default")).log(); }  }
Part04HandlingErrors { public Flux<String> timeOutWithRetry(Flux<String> colors) { return colors.concatMap(color -> simulateRemoteCall(color) .timeout(Duration.ofMillis(400)) .doOnError(s -> log.info(s.getMessage())) .retry(2).onErrorReturn("default")).log(); }  Flux<Integer> errorIsTerminal(Flux<String> numbers); Flux<Integer> handleErrorWithFallback(Flux<String> numbers); Flux<Integer> handleErrorAndContinue(Flux<String> numbers); Flux<Integer> handleErrorWithEmptyMonoAndContinue(Flux<String> numbers); Flux<String> timeOutWithRetry(Flux<String> colors); Mono<String> simulateRemoteCall(String input); }
Part04HandlingErrors { public Flux<String> timeOutWithRetry(Flux<String> colors) { return colors.concatMap(color -> simulateRemoteCall(color) .timeout(Duration.ofMillis(400)) .doOnError(s -> log.info(s.getMessage())) .retry(2).onErrorReturn("default")).log(); }  Flux<Integer> errorIsTerminal(Flux<String> numbers); Flux<Integer> handleErrorWithFallback(Flux<String> numbers); Flux<Integer> handleErrorAndContinue(Flux<String> numbers); Flux<Integer> handleErrorWithEmptyMonoAndContinue(Flux<String> numbers); Flux<String> timeOutWithRetry(Flux<String> colors); Mono<String> simulateRemoteCall(String input);  }