CircuitBreaker record a failure when a certain result is returned
See original GitHub issueRetry
allows check the result of a call and retry a call when a configurable predicate is true.
It would be nice if the CircuitBreaker allows it as well.
CircuitBreakerConfig
should allow to configure a result predicate.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:42 (28 by maintainers)
Top Results From Across the Web
Registering failed attempt inside checked function seems to ...
I'm exploring resilience4j and would like to both be able to record a failure for a circuit breaker inside a checked function, as...
Read more >Implementing a Circuit Breaker with Resilience4j - Reflectoring
When in the open state, a circuit breaker immediately returns an error to the caller without even attempting the remote call. After some ......
Read more >CircuitBreaker - resilience4j
The state of the CircuitBreaker changes from CLOSED to OPEN when the failure rate is equal or greater than a configurable threshold. For...
Read more >Failover and Circuit Breaker with Resilience4j | by Rob Golder
If the number of failed calls to the primary 3PP within a given timeframe exceeds the threshold, then the circuit is opened, and...
Read more >Resilience4j Session-5 Preventing cascading of failures in ...
Code · slidingWindowSize: Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Throwing exception from CB is not a good option in my case, that’s way I need global result predicate. I need CB to count some results as failures but not to throw an exception in that case. When a result predicate is configured CB should throw exception only when its state is open.
My idea would be to pass the an optional result here:
https://github.com/resilience4j/resilience4j/blob/master/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/CircuitBreaker.java#L558
Then create a function to handle it, similar as:
https://github.com/resilience4j/resilience4j/blob/master/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/CircuitBreakerStateMachine.java#L209
For the exception I was thinking in create something like
ResultRecordedAsFailureException
and pass it at the end.The change will have a lot of collateral changes, I know, but I can not see a better way to do it.
Let me create the PR, let’s see how it looks like, you can discard it, no personal attachment to the code, no worries … again is going to be huge, but we should be covered by tests