Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 the 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 be passed pass and if the result is success the Circuit Breaker will move to closed state, or to open state if there was an error.

...

Code Block
languagexml
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
  	<route>
    <from uri="direct:start"/>
    <loadBalance>        
        <circuitBreaker threshold="2" halfOpenAfter="1000L1000"/>
            <exception>MyExceptionProcessor</exception>
		<to uri="mock:result"/>       </circuitBreaker>
                <to uri="mock:result"/>
    </loadBalance>
  </route>
</camelContext>

...

For further examples of this pattern look at this junit test case

...