You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by John McDonald <mc...@gmail.com> on 2011/04/01 14:58:17 UTC

Error Handling

I feel this is an embarrassingly simple question - but I've read around and cant get things to happen the way I want.

I am using the following dead-letter channel as a strategy for handling errors

    	errorHandler(deadLetterChannel("log:RoutingError?level=ERROR"));

but my problem is that I am unable to control the log content.  What I would like is to be able to emit the class of exception and the exception message - but this idiom simply applies a toString() like formatting of the exchange with no indication as to what the failing content is.  I have tried adding a beanRef at the end so I can get at the good bits but it appears completely ignored

What I really want is something that stops the route treatment (not attempting to roll it back) so that I can perform my own processing including logging 

Re: Error Handling

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Apr 1, 2011 at 4:34 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Just use a direct endpoint in the DLC.
>
> Then you can use a camel route where you can grab the caused exception
> message and do whatever you want with it.
>

You can also just use a bean endpoint in the DLC.

And then in the bean (pojo) have a single method where you do with the
message what you want to do

public void logFailedMessage(Exchange exchange, Exception cause) {
   ..
}


>
> On Fri, Apr 1, 2011 at 2:58 PM, John McDonald <mc...@gmail.com> wrote:
>> I feel this is an embarrassingly simple question - but I've read around and cant get things to happen the way I want.
>>
>> I am using the following dead-letter channel as a strategy for handling errors
>>
>>        errorHandler(deadLetterChannel("log:RoutingError?level=ERROR"));
>>
>> but my problem is that I am unable to control the log content.  What I would like is to be able to emit the class of exception and the exception message - but this idiom simply applies a toString() like formatting of the exchange with no indication as to what the failing content is.  I have tried adding a beanRef at the end so I can get at the good bits but it appears completely ignored
>>
>> What I really want is something that stops the route treatment (not attempting to roll it back) so that I can perform my own processing including logging
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Error Handling

Posted by Claus Ibsen <cl...@gmail.com>.
Just use a direct endpoint in the DLC.

Then you can use a camel route where you can grab the caused exception
message and do whatever you want with it.


On Fri, Apr 1, 2011 at 2:58 PM, John McDonald <mc...@gmail.com> wrote:
> I feel this is an embarrassingly simple question - but I've read around and cant get things to happen the way I want.
>
> I am using the following dead-letter channel as a strategy for handling errors
>
>        errorHandler(deadLetterChannel("log:RoutingError?level=ERROR"));
>
> but my problem is that I am unable to control the log content.  What I would like is to be able to emit the class of exception and the exception message - but this idiom simply applies a toString() like formatting of the exchange with no indication as to what the failing content is.  I have tried adding a beanRef at the end so I can get at the good bits but it appears completely ignored
>
> What I really want is something that stops the route treatment (not attempting to roll it back) so that I can perform my own processing including logging



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/