Created
September 1, 2021 19:58
-
-
Save krnbr/aea89c7b9a15141a3a529adbc17b8717 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
@CircuitBreaker(name = "mockService", fallbackMethod = "fallback") | |
public Mono<MockServiceResponse> getMockServiceResponse() { | |
return mockServiceWebClient.get() | |
.uri(DOWNSTREAM_PATH) | |
.retrieve() | |
.bodyToMono(MockServiceResponse.class) | |
.doOnError(ex -> { | |
throw new RuntimeException("the exception message is - "+ex.getMessage()); | |
}); | |
} | |
public Mono<MockServiceResponse> fallback(Throwable ex) { | |
//Arrays.stream(ex.getStackTrace()).forEach(System.out::println); | |
System.out.println("---> "+ex.getMessage()); | |
MockServiceResponse mockServiceResponse = new MockServiceResponse(); | |
mockServiceResponse.setError(true); | |
return Mono.just(mockServiceResponse); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment