Fault Tolerance EIP

This component supports the Circuit Breaker EIP with the MicroProfile Fault Tolerance library.


The Fault Tolerance EIP supports 2 options which are listed below:

Name Description Default Type


Configures the Fault Tolerance EIP Use end when configuration is complete, to return back to the Fault Tolerance EIP.



Refers to a Fault Tolerance configuration to use for configuring the Fault Tolerance EIP.


See Fault Tolerance Configuration for all the configuration options on the Fault Tolerance Circuit Breaker.

Using Fault Tolerance EIP

Below is an example route showing a Fault Tolerance EIP circuit breaker that protects against a downstream HTTP operation with fallback.

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

And in XML DSL:

    <from uri="direct:start"/>
        <to uri="http://fooservice.com/faulty"/>
                <constant>Fallback message</constant>
    <to uri="mock:result"/>

In case the calling the downstream HTTP service is failing, and an exception is thrown then the circuit breaker will react and execute the fallback route instead.

If there was no fallback, then the circuit breaker will throw an exception.

For more information about fallback see onFallback.

Configuring Fault Tolerance

You can fine-tune the Fault Tolerance EIP by the many Fault Tolerance Configuration options.

For example to use 2 second execution timeout, you can do as follows:

        // use 2 second timeout
        .log("Fault Tolerance processing start: ${threadName}")
        .log("Fault Tolerance processing end: ${threadName}")
    .log("After Fault Tolerance ${body}");

And in XML:

  <from uri="direct:start"/>
    <faultToleranceConfiguration timeoutEnabled="true" timeoutDuration="2000"/>
    <log message="Fault Tolerance processing start: ${threadName}"/>
    <to uri="http://fooservice.com/faulty"/>
    <log message="Fault Tolerance processing end: ${threadName}"/>
  <log message="After Fault Tolerance: ${body}"/>

In this example if calling the downstream service does not return a response within 2 seconds, a timeout is triggered, and the exchange will fail with a TimeoutException.

Camel’s Error Handler and Circuit Breaker EIP

By default, the Circuit Breaker EIP handles errors by itself. This means if the circuit breaker is open, and the message fails, then Camel’s error handler is not reacting also.

However, you can enable Camels error handler with circuit breaker by enabling the inheritErrorHandler option, as shown:

// Camel's error handler that will attempt to redeliver the message 3 times

    // turn on Camel's error handler on circuit breaker so Camel can do redeliveries
        .throwException(new IllegalArgumentException("Forced"))

This example is from a test, where you can see the Circuit Breaker EIP block has been hardcoded to always fail by throwing an exception. Because the inheritErrorHandler has been enabled, then Camel’s error handler will attempt to call the Circuit Breaker EIP block again.

That means the mock:a endpoint will receive the message again, and a total of 1 + 3 = 4 message (first time + 3 redeliveries).

If we turn off the inheritErrorHandler option (default) then the Circuit Breaker EIP will only be executed once because it handled the error itself.


Camel provides the Circuit Breaker EIP in the route model, which allows to plugin different implementations. MicroProfile Fault Tolerance is one such implementation.

Maven users will need to add the following dependency to their pom.xml to use this EIP:

    <version>x.x.x</version><!-- use the same version as your Camel core version -->

Using Fault Tolerance with Spring Boot

This component does not support Spring Boot. Instead, it is supported in Standalone and with Camel Quarkus.