Hi,
I have a problem with the current Camel version 2.16.2. In version
2.15.5 it works without problems.
----------
I want to test the throwing of an exception when no response message is
received within a given timeout.
To create a timeout, I use multicast to clone the message and a delay to
wait for a response.
The Timeout route looks like:
from(getInternalRespTimeout())
.routeId("TimeoutRoute")
.errorHandler(noErrorHandler()) // propagate
exceptions to caller route
.process(resp_proc)
.delay(config.getT_resp()*1000)
.to(getInternalRespUri());
The messages come from the route:
from(Endpoints.MESSAGE_IN.direct())
.routeId(Endpoints.MESSAGE_IN.uri(this.config.getPrefix()))
.errorHandler(noErrorHandler()) // propagate
exceptions to caller route
.process(send_checker)
.process(msg2bean)
.split().method(send_controller, "split")
.process(send_controller)
.multicast().parallelProcessing()
.to(getInternalRespTimeout(),
getInternalSendUri()); // shortcut for response messages
The timeout handler works as expected and sends an exception back
through the route to the external caller.
In the test class I defined an error handler for the exception in the
test route:
ExceptionTestProcessor exc_proc = new
ExceptionTestProcessor();
onException(MessageSendException.class)
.handled(true)
.process(exc_proc)
.to("mock:sendException");
In the log I can see that the error handler receives the exception. But
also the DefaultErrorHandler is called although I told "handled(true)":
[ main] ExceptionTestProcessor WARN Exception
caught: No response received within timeout time!
[ main] DefaultErrorHandler ERROR Failed
delivery for (MessageId: ID-smdw7601-46612-1459795682397-1-1 on
ExchangeId: ID-smdw7601-46612-1459795682397-1-2). Exhausted after
delivery attempt: 1 caught:
de.dfs.camel.component.atsm.MessageSendException: No response received
within timeout time!. Processed by failure processor:
FatalFallbackErrorHandler[Pipeline[[Channel[DelegateSync[de.dfs.camel.component.atsm.ExceptionTestProcessor@e64498]],
Channel[sendTo(Endpoint[mock://sendException])]]]]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [direct://message-in ] [
1135]
[route1 ] [to7 ] [atsm:message-in ] [ 1127]
[ats-m:message-in ] [process10 ] [Processor@0x148f152 ]
[ 17]
[ats-m:message-in ] [process11 ] [Processor@0x1db6621 ]
[ 1]
[ats-m:message-in ] [split1 ]
[split[bean{de.dfs.camel.component.atsm.SendController,
method=split}] ] [ 1095]
[ ] [process14 ] [Processor@0xe64498 ] [ 1]
[ ] [to6 ] [mock:sendException ] [ 1]
Can someone give me a hint, why the DefaultErrorHandler is called?
----------
I also tested the receiption of the error message at the endpoint:
final MockEndpoint send_exc =
getMockEndpoint("mock:sendException");
send_exc.expectedMessageCount(1);
Is there something like "send_exc.expectedException(...)" I could use to
check for the correct exception?
Thanks,
Sven