So, I have a camel context that has a DeadLetterChannel with no redeliveries
at the context level. Within the context I have a route:

from("direct:input")
     .routeId("enrichHeader")
     .setHeader("myHeader").constant("someValue)
     .to("direct:output");

I have a unit test in which I interceptSendToEndpoint("direct:output") and
cause an exception to be thrown.

Then in the unit test I do producerTemplate.sendBody(theBody).

Now, as configured above on exception the message gets sent to the dead
letter channel. All's well. However, if I configure a loggingErrorHandler I
get odd behavior. So if I update the above route as follows:

from("direct:input")
     .routeId("enrichHeader")

     .errorHandler(
        loggingErrorHandler("com.myco.myproject")
             .level(LoggingLevel.WARN))

     .setHeader("myHeader").constant("someValue)
     .to("direct:output");

When I run the test now I get two unexpected behaviors. First, the exception
is still logged at level ERROR instead of the configured WARN. Second, the
exception is propagated back to the producerTemplate.sendBody(theBody)
invokation. 

On the one hand, the logging at ERROR is obviously odd. The other part that
seems odd is that the handler is propagating the exception. I would have
thought it would have marked it as handled and be done with it.

Is this expected behavior? Seems like documentation for the
LoggingErrorHandler is lacking.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Unexpected-behavior-of-LoggingErrorHandler-in-Camel-tp5729173.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to