camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juhasiltanen <juhasilta...@gmail.com>
Subject Re: Routing with RouteBuilder and onException, missing the Exception instance
Date Tue, 04 Aug 2009 09:49:54 GMT

As it seems, the exchange can not be sent through a queue for processing
after an exception has occured.

Upon exception, the control needs to be passed directly to a processor. As I
am using spring beans with dependency injections, the route definition
needed to be changed from...

onException(...).to(queueEndpoint)

... to ...

onException(...).beanRef("beanName")

... and the CamelExceptionCaught property is available at the Exchange
instance.

thanks for your help!

-J-


juhasiltanen wrote:
> 
> I am trying to get the custom exception at the point when the executions
> hits my processor implementation, not during the route configuration.
> 
> I assume, that by invoking Exchange.getProperties a full Map of properties
> is provided. Is this the case?
> 
> By iterating over the Map, only two properties are available: CamelBinding
> and CamelBeanHolder.
> 
> I am using Camel 2.0 M3
> 
> Any more ideas?
> 
> -J-
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> On Tue, Aug 4, 2009 at 9:27 AM, juhasiltanen<juhasiltanen@gmail.com>
>> wrote:
>>>
>>> I have a simple routing configuration of
>>> onException(MyException.class).to(myEndpoint)
>>>
>>> Then I have a simple implementation of a Processor interface reading
>>> from
>>> myEndpoint (that receives an Exchange), let's call it MyProcessor.
>>>
>>> How do I get the instance of MyException thrown from the depths of the
>>> application to MyProcessor?
>>>
>>> Exchange.getException returns null, and this is the place I would expect
>>> MyException to be found.
>> 
>> No its not as when you do routing in the onException then you handle it.
>> You can get the caused exception from a property
>> 
>> In Camel 2.0
>> Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>> Exception.class);
>> 
>> And its about the same in 1.x the key is different though
>> 
>> See more here:
>> http://camel.apache.org/exception-clause.html
>> 
>> In the section "using a processor as failure handler"
>> 
>>>
>>> Thank's in advance!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Routing-with-RouteBuilder-and-onException%2C-missing-the-Exception-instance-tp24803541p24803541.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Routing-with-RouteBuilder-and-onException%2C-missing-the-Exception-instance-tp24803541p24805472.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message