@Test public void retryOnResultFailAfterMaxAttemptsUsingMono() { RetryConfig config = RetryConfig.<String>custom() .retryOnResult("retry"::equals) .waitDuration(Duration.ofMillis(10)) .maxAttempts(3).build(); Retry retry = Retry.of("testName", config); given(helloWorldService.returnHelloWorld()) .willReturn("retry"); StepVerifier.create(Mono.fromCallable(helloWorldService::returnHelloWorld) .transformDeferred(RetryOperator.of(retry))) .expectSubscription() .expectNextCount(1) .expectComplete() .verify(Duration.ofSeconds(1)); then(helloWorldService).should(times(3)).returnHelloWorld(); }
public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); static RetryOperator<T> of(Retry retry); @Override Publisher<T> apply(Publisher<T> publisher); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); static RetryOperator<T> of(Retry retry); @Override Publisher<T> apply(Publisher<T> publisher);  }