-
1. Re: Switchyard invocation terminates prematurely when using handled(true) in Camel route
kcbabo Feb 18, 2014 8:17 AM (in response to bernard.tison)Hey Bernard,
Sorry to let this thread slip through the cracks. I will have a look today.
~ keith
-
2. Re: Switchyard invocation terminates prematurely when using handled(true) in Camel route
kcbabo Mar 3, 2014 5:14 PM (in response to kcbabo)Coming back to this (finally), I agree that the the error handled property should not propagate out of the service route into our internal bus route. In fact, there are quite a few camel headers which really should stay local to the service route. I suspect the right thing to do here is to exclude all "Camel*" properties when mapping from the service route into the bus route. We can allow for an override which the user can use to specify certain Camel properties that can propagate (e.g. CamelFileName).
That said, I'm still a bit annoyed at the timeout on the response. The consumer callback is not being invoked and I need to do a bit more digging to figure out why that's the case. The above JIRA will fix this case, but I will report back with any additional findings as I, err ... find them.
-
3. Re: Re: Switchyard invocation terminates prematurely when using handled(true) in Camel route
kcbabo Mar 4, 2014 8:57 AM (in response to kcbabo)A few follow-up items:
Camel Pipeline breaks the processor chain if the Exchange.ERRORHANDLER_HANDLED property is present. This was a bit surprising to me, but with this in mind, everything else makes sense.
- camel/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java at master · apache/camel · GitHub
- camel/camel-core/src/main/java/org/apache/camel/processor/PipelineHelper.java at master · apache/camel · GitHub
- camel/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java at master · apache/camel · GitHub
One thing I forgot to mention in my last reply is that in most cases you should attach your onException handler inside the route instead of outside (as it is now). If the onException handler is outside the route, it's registered as a global handler within the Camel context. Since all routes in a SY application share the same context, a handler defined outside the route will apply to all routes.
We will fix the underlying bug which allows Exchange.ERRORHANDLER_HANDLED to leak out of the service, but in the meantime, adding the following code to your error handling logic should fix things up:
onException(Exception.class) .process( new Processor() { public void process(Exchange exchange) throws Exception { // your error handling logic here exchange.setProperty(Exchange.ERRORHANDLER_HANDLED, false); exchange.removeProperty("CamelExceptionCaught"); } }) .handled(true) .end()