camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Tully" <>
Subject Re: error handler
Date Wed, 27 Feb 2008 15:24:15 GMT
On 26/02/2008, cmdr <> wrote:
>  Hello
>  How does the error handler is supose to work ?
If you have not seen it, there is some good information at

>  from("file://data.txt?delete=false")
>  .process(new Processor()
>  {
>         public void process(Exchange exchange) throws Exception
>         {
>                 throw new Exception("Processing exception");
>         }
>  }).errorHandler(deadLetterChannel("activemq:queue:errors").maximumRedeliveries(2));
>  what does that code do ?
I think the errorHandler specified will not be used as it is attached
to the route from the processor which throws an exception rather than
to the 'from' clause that routes to the processor. To put it another
way, the error handler needs to wrap rather than follow, an event
driven consumer.

Because the from clause, which experiences the exception, does not
have a specified errorHandler, the default deadLetterChannel error
handler will kick in. The default deadLetterChannel routes messages to
the log: endpoint which will use the default logging implementation,
very often system.out .

>  It send the exception to activemq ?
>  It print all exception in the system output ?
so in the case above, nothing goes to activemq and the message with
the exception as a message property, will end up being logged.

Your error handler could be set globally as in:

  from("file://data.txt?delete=false").process(new Processor() ....

and it would then be inherited by all routes in the context.

>  cmdr
> --
>  View this message in context:
>  Sent from the Camel - Users mailing list archive at

View raw message