You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by chege <ch...@programmer.net> on 2019/08/08 09:46:49 UTC
How to hande exceptions raised in "interceptSendToEndpoint"
Hi,
I have a parent route builder that defines an interceptor and excpetion
handler as follows.
onException(Exception.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("Handling Error");
}
});
interceptSendToEndpoint("velocity://*")
.setHeader("includeplaintext", () -> "true")
.setHeader("CamelVelocitySupplementalContext",
method("mailRouter", "x"));
Here is a simplified definition of method "x"
public Map<String, Object> x(@Header("test") String schema) {
throw new RuntimeException("error");
}
Then I have a route that will trigger above interceptor defined as
follows.
from("activemq://queue:inquiryresponse")
.routeId("Inquiry Response")
.log("Sending Inquiry Response ${body}")
.setHeader("subject", constant("Inquiry Response"))
.setHeader("to",
simple("${body['fname']}<${body['ccemail']}>"))
.to("velocity://templates/inquiry_response.html")
.to("bean:mailRouter?method=routeEmail")
.log("Sent Inquiry Response ${body}");
The exception handler above is not invoked. What I am missing?
Thanks,
Chege.