question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify usage of CircuitBreaker with Reactor

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RobWincommented, Apr 15, 2020

It has been replaced a while ago but CallNotPermittedException

0reactions
HabeebCyclecommented, Apr 15, 2020

Thanks bro!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found