camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goyal, Arpit" <>
Subject RE: Try-Catch in choice-when
Date Wed, 13 Nov 2013 13:15:17 GMT
Any idea how can I achieve the following?

-----Original Message-----
From: Goyal, Arpit [] 
Sent: Wednesday, November 13, 2013 9:42 AM
Subject: Try-Catch in choice-when

Hi All,

I am trying to use Try-Catch inside 'when' but not sure how to get it right. I am using BLUEPRINT
DSL. Following is my route:

<camel:from ref="Sender"/>

<camel:setHeader headerName="MyHeader">

<camel:xpath>//MessageId = 'a'</camel:xpath>
<camel:to ref="Receiver1"/>
                                                                <camel:to uri="log:TryCatchEval?level=INFO"/>
<camel:simple>${header.MyHeader} == 'GOOD'</camel:simple>
<camel:to ref="Receiver_"/>

Here the prefix camel stands for xmlns:camel=

Basically the idea which we want to achieve is, in case my first condition fails (due to some
exception), I want to execute the second condition and have hard restriction that I can't
change my pattern of choice-when.

As per the camel-blueprint xsd (,
whenDefinition expects first element to be some language element and then allows Try-Catch.
What if the language it-self throws exception? How can I prevent that?


View raw message