2008-11-23

We, the good Camel riders, get numerous times positive feedback from end users that they appreciate the great community that spins around Camel.

As a rider myself I enjoy all the great feedback we receive and it helps steer the Camel in the right direction.

Lately I have been in dialog with an end-user that had a bit more advanced use case for routing and handling certain custom exceptions. So after discussing and realizing that he needed an improvement in Camel I created the ticket for it.

The use caseThe use case is that in case of a org.my.exception.FunctionalException is thrown and this exception is in a certain state then route the message to a certain bean handler. This can be expressed like this:

The problemThe problem by its core is that Camel in case of an exception being thrown will look for (if any) onException that should handle it. And currently you can only state a list of exceptions and if the thrown exception is an instanceof on of these exceptions Camel will choice the first onException defined that matches. But the end-users needed to alter this choice to also express a predicate so the matching will only occur if the predicate is true as well.

Camel is very flexible and the end user could actually implement this right out of the box, however he needed to provide his own ExceptionPolicyStrategty that contains the logic to select which onException to handle the given thrown exception. So he could have implemented the org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy interface and defined Camel to use this policy instead of the default. Yes Camel is flexible.But as the author of this policy in the first place I picked up the glove to add this directly to Camel. Here is a short summary how this was done:

The solution1)First of all I added the when predicate to the onException so you can add it (optional).

@XmlElement(name = "when", required = false)private WhenType when;

Camel supports both Java DSL and spring DSL. As the Spring DSL XSD is auto generated we only add the JAXB binding annotations to control the XSD.

2)I then had to improve the DefaultExceptionPolicyStrategy to consider this new predicate (when).

Basically I had to add this piece of code, that in case if a when predicate is provided will match it, for onException without this predicate it returns true.

And the final routeNow we can add the onWhen predicate that will call a method on the bean mySpecialEnumChecker that will return either true or false. So the onException is only triggered when the exception FunctionalException is thrown + the predicate returns true.

2008-11-12

License Certificate LC-XXXXX for IntelliJ IDEA

As an open source developer on the Apache Camel project I received a free license for Intellij IDEA 8.x today in my mail box. Thanks Jetbrains.

As a constant user of IDEA for the last 6+ years I am glad that IDEA 8.x has been focused on faster startup time. I am glad that you can install the plugins that you need and especially the ones you don't need. Oh and by they way they have bundled my plugin now.

The announcement of the release has hit the server side, so you can go there and enjoy the IDE wars that tend to get started when personal feelings is involved with your favorite tool.

Apache Camel is really as Bruce write very much a community driven development ;) The Camel riders takes the community very seriously and we are active on the forums and as well on the IRC chat.

For me personally this is the 3rd consecutive released I have been involved with. Early Camel riders on the 1.2 or older much have noticed that we have picked up the pace and have released 3 major releases this year yet alone. Each release containing more than 200 issues addressed.

This release has widespread new features, improvements and bug fixes that it would take me quite some time to blog. So go read the release note that has detailed information about the changes.

This is again a marvelous work by both the Camel developers and the community behind it.