Allow optional wrapping in NoFallbackAvailableException in CircuitBreaker
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con la classe CircuitBreaker in spring-cloud-commons/src/main/java/org/springframework/cloud/client/circuitbreaker/CircuitBreaker.java e verifica come il metodo run predefinito avvolge le eccezioni. Definisci come una proprietà di configurazione opzionale debba controllare questo comportamento, assicurandoti che la disabilitazione dell’avvolgimento conservi l’eccezione originale e che l’abilitazione dell’avvolgimento mantenga il comportamento di NoFallbackAvailableException.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
I'm building an application with Spring Cloud 2023 using Feign and Resilience4j.
In the CircuitBreaker class, methods that do not have a fallback by default have any exceptions thrown wrapped in a NoFallbackAvailableException:
default <T> T run(Supplier<T> toRun) {
return run(toRun, throwable -> {
throw new NoFallbackAvailableException("No fallback available.", throwable);
});
}
This is not behaviour that we see with the vanilla implementation of Resilience4j, which just throws the exception as it is, without wrapping it.
I noticed this behaviour because I want to ignore an exception across all circuit breakers, and so set the following property resilience4j.circuitbreaker.configs.default.ignore-exceptions=.... With the automatic wrapping, however, higher-level code should be expecting a NoFallbackAvailableException instead of the exception that's actually been marked as ignored. Additionally, higher-level circuit breakers will not be able to continue ignoring this exception. [1]
Describe the solution you'd like
Would it be possible to make wrapping the exception in a NoFallbackAvailableException optional, controlled by some kind of property?
Describe alternatives you've considered
We can of course catch the NoFallbackAvailableException, get the root cause and then throw that exception.
[1] I know that multiple stacked circuit breakers aren't ideal, however I would like all Feign calls to be protected by circuit breakers, which can be done with the following property spring.cloud.openfeign.circuitbreaker.enabled=true. The downside of using this property is that you have no control over the fallbacks for those automatic circuit breakers. In this particular case, I am unable to add a fallback to the feign client itself, as it is shared among different services. Because of this, I would like to add a manual circuit breaker around the code using @CircuitBreaker(name = "getX", fallbackMethod = "getFallbackX").
- Lingua principale
- Java
- Stelle
- 750
- Fork
- 749
- Merge medio
- 17h 13m
- PR unite (30g)
- 23
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-cloud/spring-cloud-commons
-
waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
spring-cloud/spring-cloud-commons#1708 ·
I maintainer di solito rispondono entro 1 giorno
-
waiting-for-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
spring-cloud/spring-cloud-commons#1543 ·
I maintainer di solito rispondono entro 1 giorno
-
waiting-for-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 48/100
spring-cloud/spring-cloud-commons#1727 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement for team discussion
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
spring-cloud/spring-cloud-commons#1676 ·
I maintainer di solito rispondono entro 1 giorno
-
waiting-for-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
spring-cloud/spring-cloud-commons#1675 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di spring-cloud/spring-cloud-commons
Issue simili
-
agent:working follow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Sanne/incus-spawn#1683 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
checkstyle/checkstyle#22210 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
521xueweihan/HelloGitHub#4105 ·
-
devops good first issue security
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
asciidoctor/asciidoctorj#1339 ·