Last active
December 24, 2019 10:35
-
-
Save ayushi24041992/3200e3a7aad2eba90c9a9d038021e5fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void fluxErrorHandling_withRetryBackoff(){ | |
Flux<String> stringFlux = Flux.just("a","b","c") | |
.concatWith(Flux.error(new RuntimeException("Exception Occurred"))) | |
.concatWith(Flux.just("D")) | |
.onErrorMap((e) -> new CustomException(e)) | |
.retryBackoff(2, Duration.ofSeconds(5));// when you want to perform a backoff before retry | |
StepVerifier.create(stringFlux.log()) | |
.expectSubscription() | |
.expectNext("a","b","c") | |
.expectNext("a","b","c") | |
.expectNext("a","b","c") | |
.expectError(IllegalStateException.class) | |
.verify(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment