You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sub3 <st...@subwest.com> on 2009/11/21 04:57:49 UTC

DeadLetter - Get Stack Trace

Hi,

I have the dead letter channel set up to catch errors:
errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor?method=handleError").maximumRedeliveries(1));

I am getting the incoming object that is causing the error, but I would also
like to get the error/exception this is thrown.  Is there anyway to
configure this to get that?

Thanks.

-- 
View this message in context: http://old.nabble.com/DeadLetter---Get-Stack-Trace-tp26453580p26453580.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DeadLetter - Get Stack Trace

Posted by sub3 <st...@subwest.com>.
That works great.  Thanks.


Claus Ibsen-2 wrote:
> 
> On Sat, Nov 21, 2009 at 4:57 AM, sub3 <st...@subwest.com> wrote:
>>
>> Hi,
>>
>> I have the dead letter channel set up to catch errors:
>> errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor?method=handleError").maximumRedeliveries(1));
>>
>> I am getting the incoming object that is causing the error, but I would
>> also
>> like to get the error/exception this is thrown.  Is there anyway to
>> configure this to get that?
>>
> 
> Yeah since you use a bean you can just add Exception cause as a
> parameter to your handleError method, eg.
> 
> public void handleError(Object body, Exception exception)
> 
> There is a bit more info here
> http://camel.apache.org/bean-binding.html
> 
> or get it from the Exchange where its stored in a property. I think
> the key is this name but you may have to double check yourself.
> 
> Exception cause = Exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
> Exception.class);
> 
> In 1.x the key for the property may reside on a different class. Just
> take a look with the debugger what the Exchange properties looks like
> and you can find the cause exception in there.
> 
> 
> 
>> Thanks.
>>
>> --
>> View this message in context:
>> http://old.nabble.com/DeadLetter---Get-Stack-Trace-tp26453580p26453580.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/DeadLetter---Get-Stack-Trace-tp26453580p26467896.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: DeadLetter - Get Stack Trace

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Nov 21, 2009 at 4:57 AM, sub3 <st...@subwest.com> wrote:
>
> Hi,
>
> I have the dead letter channel set up to catch errors:
> errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor?method=handleError").maximumRedeliveries(1));
>
> I am getting the incoming object that is causing the error, but I would also
> like to get the error/exception this is thrown.  Is there anyway to
> configure this to get that?
>

Yeah since you use a bean you can just add Exception cause as a
parameter to your handleError method, eg.

public void handleError(Object body, Exception exception)

There is a bit more info here
http://camel.apache.org/bean-binding.html

or get it from the Exchange where its stored in a property. I think
the key is this name but you may have to double check yourself.

Exception cause = Exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Exception.class);

In 1.x the key for the property may reside on a different class. Just
take a look with the debugger what the Exchange properties looks like
and you can find the cause exception in there.



> Thanks.
>
> --
> View this message in context: http://old.nabble.com/DeadLetter---Get-Stack-Trace-tp26453580p26453580.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