Код: Выделить всё
@Bulkhead(name = "getToken", type = Bulkhead.Type.THREADPOOL)
@TimeLimiter(name = "getToken")
@CircuitBreaker(name = "getToken", fallbackMethod = "fallbackRequestException")
public ResponseEntity getByTokenPayload(HttpHeaders headers, String url) {
return CompletableFuture.supplyAsync(() -> {
ResponseEntity result = service.getByTokenResource(headers, url);
}).thenApply(result -> {
return result;
});
}
Код: Выделить всё
private ResponseEntity fallbackRequestException(Exception e) throws BadRequestException {
return ResponseEntity.status(HttpStatus.OK).body("Fallback response");
}
Код: Выделить всё
fallback.FallbackExecutor : No fallback method match found
java.lang.NoSuchMethodException: class java.util.concurrent.CompletableFuture class com.test.Connector.fallbackRequestException(class org.springframework.http.HttpHeaders,class java.lang.String,class java.lang.Throwable)
at io.github.resilience4j.spring6.fallback.FallbackMethod.create(FallbackMethod.java:93) ~[resilience4j-spring6-2.1.0.jar!/:2.1.0]
Подробнее здесь: https://stackoverflow.com/questions/790 ... atch-found
Мобильная версия