camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jorabin <>
Subject Dead Letter ErrorHandler and onException
Date Thu, 23 Jul 2015 16:24:07 GMT
As I understand it, if you have an exception handler then the dead letter
processing should not get invoked.
However, according to the tests below if you do not have some kind of
processor in the exception handler, the dead letter logic does in fact get
Is this behavior by design? It is certainly very confusing, since two
exception handlers differing only in whether they contain a "log" or not
behave differently, as in the following unit test:
    public static class InterestingException extends Exception {}    public
static class LessInterestingException extends Exception {}    RouteBuilder
errorHandlerRoute = new RouteBuilder() {        @Override        public void
configure() throws Exception {            from("direct:in")                   
.handled(true)                    .end()                   
.handled(true)                        .log("handling less interesting
exception")                    .end()                    .choice()                   
.throwException(new InterestingException())                   
.throwException(new LessInterestingException())                   
.endChoice();            from("direct:dlc")                    .log("I am
the dead letter channel")                    .setBody(constant("Dead
Letter"));        }    };    @Test    public void test5() throws Exception {       
context().addRoutes(errorHandlerRoute);        String answer =
template().requestBodyAndHeader("direct:in", "", "interesting", true,
String.class);        assertEquals("Dead Letter", answer);        answer =
template().requestBodyAndHeader("direct:in", "", "lessInteresting", true,
String.class);        assertNotEquals("Dead Letter", answer);    }

View this message in context:
Sent from the Camel - Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message