Circuit Breaker EIP (deprecated)

The Circuit Breaker load balancer is a stateful pattern that monitors all calls for certain exceptions. Initially the Circuit Breaker is in closed state and passes all messages. If there are failures and the threshold is reached, it moves to open state and rejects all calls until halfOpenAfter timeout is reached. After this timeout is reached, if there is a new call, it will pass and if the result is success the Circuit Breaker will move to closed state, or to open state if there was an error. When the circuit breaker is closed, it will throw a java.util.concurrent.RejectedExecutionException. This can then be caught to provide an alternate path for processing exchanges.

The Circuit Breaker EIP supports 3 options which are listed below:

Name Description Default Type


A list of class names for specific exceptions to monitor. If no exceptions is configured then all exceptions is monitored



The timeout in millis to use as threshold to move state from closed to half-open or open state



Number of previous failed messages to use as threshold to move state from closed to half-open or open state


An example using Java DSL:

        .circuitBreaker(2, 1000L, MyCustomException.class)

And the same example using Spring XML:

<camelContext id="camel" xmlns="">
        <from uri="direct:start"/>
            <to uri="mock:serviceUnavailable"/>
            <circuitBreaker threshold="2" halfOpenAfter="1000">
            <to uri="mock:service"/>