Hi - I am need of some help in understanding more about exception handling.
I am using Camel 2.2 inside of Servicemix 3.3.2 (along with XMLBeans and
Spring).
What I need to happen is that the nature of the exception is populated
inside the message and then forwarded to an error queue. What *appears* to
be happening is that the message prior to it being processed by the bean is
being forwarded into the queue. If you have any suggestions, please let me
know - Thanks.
Verification Bean
----------------
if ( goodOrder )
exchange.getOut().setBody(orderDocument.xmlText());
else {
this.processOrderError(orderDocument, errorLog.toString());
exchange.getOut().setHeader(Exchange.FILE_NAME,
getOrderNumber(orderDocument)+".error."+System.nanoTime()+".xml");
System.out.println(orderDocument.getClarisonicWebOrder().getProcessing().toString());
exchange.getOut().setBody(orderDocument.xmlText());
throw new Exception("Failed Order Verification");
}
// Note: the processOrderMessage() inserts the error message in a defined
area. The subsequent System.out.println() confirms that the error message
is correctly inserted.
My Spring is:
<camelContext id="camelContext"
xmlns="http://camel.apache.org/schema/spring">
<package>myPackage</package>
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="0" />
<handled>
<constant>true</constant>
</handled>
<to uri="jms://queue/order-error" />
</onException>
<route>
<from uri="jms://queue/order-file-processor"/>
<pipeline>
<bean ref="orderVerifier" method="processMessage"/>
<bean ref="orderRuleEnforcer" method="processMessage"/>
<bean ref="orderPostprocessor" method="processMessage"/>
<to uri="jms://queue/order-data-processor"/>
</pipeline>
</route>
</camelContext>
The XML that outputs from the order-error queue does not contain the error
message (that I have confirmed in the aforementioned System.out method).
Thanks for your help.
--
View this message in context:
http://camel.465427.n5.nabble.com/OnException-appears-to-roll-back-message-state-Need-help-in-understanding-tp3245784p3245784.html
Sent from the Camel - Users mailing list archive at Nabble.com.