Circuit Breaker

The Circuit Breaker pattern is inspired by the real-world electrical circuit breaker, which is used to detect excessive current draw and fail fast to protect electrical equipment. The software-based circuit breaker works on the same notion, by encapsulating the operation and monitoring it for failures. The Circuit Breaker pattern operates in three states, as illustrated in the following figure:


The states are as follows:

  • Closed — When operating successfully.

  • Open — When failure is detected, and the breaker opens to short-circuit and fail fast. In this state, the circuit breaker avoids invoking the protected operation and avoids putting additional load on the struggling service.

  • Half Open — After a short period in the open state, an operation is attempted to see whether it can complete successfully, and depending on the outcome, it will transfer to either open or closed state.

The Circuit Breaker eip supports 4 options, which are listed below.

Name Description Default Type


Configures the circuit breaker to use Resilience4j with the given configuration.



Configures the circuit breaker to use MicroProfile Fault Tolerance with the given configuration.



Refers to a circuit breaker configuration (such as resillience4j, or microprofile-fault-tolerance) to use for configuring the circuit breaker EIP.



Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime.




Sets the description of this node.



Below is an example route showing a circuit breaker endpoint that protects against slow operation by falling back to the in-lined fallback route.

By default, the timeout request is just *1000ms, so the HTTP endpoint has to be fairly quick to succeed.

        .transform().constant("Fallback message")

And in XML DSL:

  <from uri="direct:start"/>
    <to uri=""/>
        <constant>Fallback message</constant>
  <to uri="mock:result"/>

Circuit Breaker components

Camel provides two implementations of this pattern: