camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrè <morpheusan...@web.de>
Subject Re: Is it possible to propagate an exception to the parent route?
Date Fri, 01 Jul 2011 16:06:40 GMT
i´m trying that by wrapping an exception in a RuntimeCamelException and the
exception consumer is dewraping and throwing it again, 
but at the producer i´m getting a nullpointer, so somewhere i´m loosing the
exception, cause i should get the runtimecamelException ...

any ideas ? 
(thx, your answers already helped that much.. )
(Exception producer)
	<from
			
uri="activemq:topic:services.global.xacml.authzRequests?transferException=true"
/>
			<log message=" Xacml request consumed" />
			<doTry>
				<to uri="bean:pdp" />
				<doCatch>
					<exception>org.jboss.security.xacml.sunxacml.ParsingException
					</exception>
					<process ref="ExceptionWrapper"/>
				</doCatch>
			</doTry>
(Wrapper)
	public void process(Exchange exchange) throws Exception {
		
		Exception e = exchange.getException();
		RuntimeCamelException wrapper = new RuntimeCamelException(e.getCause());
		wrapper.setStackTrace(e.getStackTrace());
		exchange.setException(wrapper);

	}


(Exception consumer)
			<from uri="direct:AuthzService" />
			<to uri="bean:isAuthZBlocked?method=checkRequest" />
			<doTry>
				<to
				
uri="activemq:topic:services.global.xacml.authzRequests?transferException=true"
/>
				<doCatch>
					<exception>org.apache.camel.RuntimeCamelException</exception>
					<process ref="ExceptionDeWrapper" />
				</doCatch>
			</doTry>

(DeWrapper)
	public void process(Exchange exchange) throws Exception {
		throw exchange.getException(); 
}


--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-possible-to-propagate-an-exception-to-the-parent-route-tp4541827p4542595.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message