On Mon, Dec 7, 2009 at 1:19 PM, trivedi kumar b
<[email protected]> wrote:
>
> Hi,
>
> Eventhough I use doTry().. doCatch() blocks to handle the issue that Jens
> explained before, the problem is still exists, this is how my route looks
> like in which the call never goes to "direct:C" when there is an exception
> in sub-route "B":
>        from("direct:A")
>                .to("direct:B")
>                .to("direct:C");
>
>        from("direct:B")
>                .doTry()
>                        .transacted().end()
>                        .code goes that throws an exception
>                .doCatch(Exception.class)
>                        .handled(true)
>                        .markRollbackOnly()
>                .end();
>
>        from("direct:C")
>                .....
>

Yeah the original ticket is not resolved


>
> Claus Ibsen-2 wrote:
>>
>> On Sun, Dec 6, 2009 at 11:25 PM, trivedi kumar b
>> <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> If I use doTry.. doCatch, with similar route that includes transactions,
>>> will that work as expected? I mean, markRollbackOnly() option inside
>>> doCatch() will rollback the transaction? Pls let me know the behaviour.
>>>
>>
>> Yes markRollbackOnly() is only for transactions and will issue a
>> status.setRollbackOnly() on the Spring Transaction underneath.
>> That should render the transaction outcome as rollback only.
>>
>> It will not tamper with the Exchange by setting an exception as
>> rollback() does by setting a RollbackException on the Exchange.
>>
>>
>>
>>
>>
>>> Thanks,
>>> Trivedi
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Thu, Dec 3, 2009 at 10:45 AM, kyt <[email protected]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I need some advice on how to handle an exception in a sub-route and how
>>>>> the
>>>>> calling route can continue processing. It is easier to explain this
>>>>> with
>>>>> a
>>>>> bit of code:
>>>>>
>>>>>            from("direct:A")
>>>>>                .to("direct:B")
>>>>>                .to("direct:C");
>>>>>
>>>>>            from("direct:B")
>>>>>                .onException(Exception.class).handled(true).end()
>>>>>                . code that throws an exception
>>>>>
>>>>>            from("direct:C")
>>>>>                ...
>>>>>
>>>>> Now, if there is an exception in direct:B, direct:C never gets called.
>>>>> Through debugging I found out that the pipeline in direct:A stops
>>>>> processing
>>>>> because it checks an exchange property (Exchange.ERRORHANDLER_HANDLED).
>>>>> I'm
>>>>> using Camel 2.0. Is there a way that the processing in direct:A
>>>>> continues
>>>>> after the exception was handled in direct:B?
>>>>>
>>>>
>>>> Unfortunately the logic for error handling got a bit complex.
>>>> Something to improve in 2.2. I am currently making the TX based
>>>> simpler in internal logic.
>>>>
>>>> Back to your use case.
>>>> The doTry .. doCatch will work as regular try .. catch and thus what
>>>> you would expect so route A will continue
>>>>
>>>> In terms on onException we should improve this over time, adding some
>>>> flag to indicate what you want. As some want to use onException to
>>>> catch that error and create a custom error messages as reply and thus
>>>> not process and further.  And others as you want a kinda try .. catch
>>>> logic and just ignore the damn exception.
>>>>
>>>>
>>>>> Thanks,
>>>>> Jens
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/handled-exception-in-sub-route-tp26623326p26623326.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/handled-exception-in-sub-route-tp26623326p26669550.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/handled-exception-in-sub-route-tp26623326p26676468.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to