Camel 2.19 was recently released. You can read about that on Claus Ibsen’s blog. A quick look through the release notes and it will be readily apparent that there are numerous new features that went into this version.
One of the new features is the ThrottlingExceptionRoutePolicy, which implements the circuit breaker pattern.
The circuit breaker pattern is described by Martin Fowler on his bliki as follows:
The basic idea behind the circuit breaker is very simple. You wrap a protected function call in a circuit breaker object, which monitors for failures. Once the failures reach a certain threshold, the circuit breaker trips, and all further calls to the circuit breaker return with an error, without the protected call being made at all.
Now if you have used Camel for any length of time you may be wondering why is there another implementation of this pattern. After all Camel already provides two.
The first was released with 2.14 and was added by extending
LoadBalancerSupport in the
CircuitBreakerLoadBalancer. The documentation can be found on the Camel site under the Load Balancer EIP. The slightly modified sample DSL is from the Camel documentation.
from("direct:start") .onException(RejectedExecutionException.class) .handled(true) .transform().constant("service unavailable") .end() .loadBalance() .circuitBreaker(2, 1000L, MyCustomException.class) .to("mock:service") .end();
In the prior release of Camel (2.18), the Netflix Hystrix circuit breaker implementation was added to the expanding set of Camel capabilities. The slightly modified sample DSL is from the Camel documentation. Continue reading “Yet another Camel Circuit Breaker…”