camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shyenuganti <>
Subject Issue with using onException()
Date Wed, 08 May 2013 21:15:17 GMT
Hi All, 

Here is my route. The goal I am trying to achieve is to send a STATUS
(0=success, 1= failure) back to the caller.  It works for a successful
execution. I am returning a 0 from the onCompletion().

When the route fails at the ".unmarshal(beanIO)" step I need to stop
processing the route any further, and reply back with a 0 to the consumer on

But, As of now, the route does not stop on exception as it is handled it in
doCatch(). How can I stop the route here and send a response back? Currently
it gives me an error saying "no consumers present on direct:routeStatus".
Why is this a problem when it was working for the success scenario?

Does the onCompletion() execute even on exception cases?

When I try to use one single try catch(), It is giving me an error saying
ChoiceDefinition do not support doCatch(). Why is it so ? 

				.log("Returning Status of the route: ${body}")

			.beanRef("loggingBean", "logDebug(${id}, '"+this.getClass().getName()+"',
'Reading Flat File')")
				.beanRef("loggingBean", "endError(${id},
'"+this.getClass().getName()+"',  ${exception}, 'Exception while
Unmarshalling File : ${header.CamelFileName} ')")
						   		.beanRef("loggingBean", "logDebug( ${id},
'"+this.getClass().getName()+"', 'Transaction Status :"+ simple("${body}")
								.beanRef("loggingBean", "endError(${id},
'"+this.getClass().getName()+"',  ${exception}, 'Exception while sending
StatusRequest to JMS queue')")

How can I properly use onException() in my above route to achieve the same?
I tried putting it at different places. But nothing seems to work. I am not
able to propagate the exception properly. 

Can anyone really help with this?

THanks !

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message