Clarify usage of CircuitBreaker with Reactor
See original GitHub issueI am evaluating resilience4j for use in a project in which we using Reactor 3. I think that I am misunderstanding how the CircuitBreaker works, but I cannot find any clarity in the documentation.
Here is a simple test case (written in Groovy using Spock):
def "test CircuitBreaker"() {
given: "a Flux which emits one exception protected by a circuitBreaker"
def aCircuitBreakerConfig = CircuitBreakerConfig.custom()
.waitDurationInOpenState(Duration.ofSeconds(5))
.ringBufferSizeInClosedState(3)
.ringBufferSizeInHalfOpenState(1)
.failureRateThreshold(50.0)
.build()
def circuitBreakerRegistry = CircuitBreakerRegistry.of(aCircuitBreakerConfig)
def circuitBreaker = circuitBreakerRegistry.circuitBreaker("testCB")
def testFlux = Flux.just(new RuntimeException(), 0L, 3L, 6L, 9L)
.transform(CircuitBreakerOperator.of(circuitBreaker)).log()
when: "the Flux is subscribed"
StepVerifier.create(testFlux)
.expectSubscription()
.expectNext(0L)
.expectNext(3L)
.expectNext(6L)
.expectNext(9L)
.verifyComplete()
then: "it correctly emits four values and then completes"
notThrown(Throwable)
}
What I expected was that the circuitBreaker would drop the exception, adding the error bit to the ring buffer, and continue operation with the next element in the Flux. Instead the exception is passed on, and the test fails.
Can someone please clarify the behavior of a CircuitBreaker when applied to a Reactor 3 Flux. Does it always pass on errors until transitioning to the Open state, or is there a way to have it simply drop the error (similar to onErrorContinue)?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
"Reactor Trip Breakers." - Nuclear Regulatory Commission
As a result of failure of reactor trip circuit breakers (RFBs) to function at Salem 1 (IE Bulletin 83-01), SCE perfomed its 18...
Read more >Why use Circuit Breaker and Bulkhead when working with ...
Please help me find reasons why Circuit breaker and Bulkhead patterns are useful in a Spring Reactor application.
Read more >Testing of Reactor Switching for UHV Circuit Breakers
Reactor switching is a test duty for circuit breakers (CBs) in special locations. This duty is characterized by a relatively low current but ......
Read more >Controlled switching technique for minimization of switching ...
Controlled Switching Device (CSD) is considered to be the replacement of Pre-Insertion Resistor (PIR). Moreover, tie Circuit Breaker (CB) used in ...
Read more >AC High Voltage Circuit Breakers
Another solution is to use heating belts (for Dead tank circuit breakers). ... Shunt reactor switching in IEC 62271-110 and Guide IEEE. C37.015....
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
It has been replaced a while ago but
CallNotPermittedException
Thanks bro!