What version of Camel are you using?

And what JMS broker?

On Wed, Sep 7, 2011 at 5:06 PM, pkleczka <[email protected]> wrote:
> Hi Willem
>
> I have included part of the Camel XML and my ExceptionResponse class below.
> One of the routes works as expected and one of them does not.
> Further debuging shows that the one that works gets a
> org.apache.camel.component.jms.JmsMessage
> And the one that is not working is getting a
> org.apache.camel.impl.DefaultMessage.
>
>
>
>   <bean id="exceptionResponse"
> class="gov.nmcourts.ecitation.busrules.ExceptionResponse" />
>
>
>    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
>
>
>
>        <route id="EFileBatchRequestValidate" trace="true">
>            <from uri="properties:{{queue.efilebatch.request}}" />
>            <to uri="properties:{{log.efilebatch.request}}" />
>            <setHeader headerName="JMSCorrelationID">
>                <simple>${header.JMSMessageID}</simple>
>            </setHeader>
>
>            <doTry>
>                <to id="tracsValidator"
> uri="properties:{{validator.efilebatch.TRACSEFileBatch}}" />
>                <to
> uri="properties:{{queue.efilebatch.request.validatedtracsxsd}}" />
>                <wireTap uri="properties:{{queue.efilebatch.request.tap}}"
> />
>                <doCatch>
>
>                    <exception>org.xml.sax.SAXParseException</exception>
>
> <exception>org.apache.camel.ValidationException</exception>
>                    <bean ref="exceptionResponse" method="respond" />
>                    <to
> uri="properties:{{queue.efilebatch.request.rejected}}" />
>                    <to uri="properties:{{queue.efilebatch.response}}" />
>                </doCatch>
>            </doTry>
>        </route>
>
>
>
>        <route id="EFileBatchBusinessRulesRequestCheck">
>           <from uri="properties:{{queue.efilebatch.request.transformed}}"
> />
>
>
>               <bean ref="orderChargesTransformation" method="transform" />
>
>               <bean ref="fileDateTransformation" method="transform" />
>
>               <bean ref="chargeLookupTransformation" method="transform" />
>
>
>               <bean ref="busRuleSameCiteeValidation" method="validate" />
>               <to
> uri="properties:{{queue.efilebatch.request.validatedxsdbusrules}}" />
>
>
>            <onException useOriginalMessage="true">
>
> <exception>gov.nmcourts.ecitation.busrules.exception.BusinessRuleValidationException</exception>
>                <handled><constant>true</constant></handled>
>                <bean ref="exceptionResponse" method="respond" />
>                <to
> uri="properties:{{queue.efilebatch.request.busrulerejected}}" />
>                <to uri="properties:{{queue.efilebatch.response}}" />
>            </onException>
>
>
>            <onException useOriginalMessage="true">
>
> <exception>gov.nmcourts.ecitation.busrules.exception.BusinessRuleProcessingException</exception>
>                <handled><constant>true</constant></handled>
>                <bean ref="exceptionResponse" method="respond" />
>                <to uri="properties:{{queue.efilebatch.request.rejected}}" />
>                <to uri="properties:{{queue.efilebatch.response}}" />
>            </onException>
>        </route>
>
>
> public class ExceptionResponse {
>
>        private static Logger log = Logger.getLogger(ExceptionResponse.class);
>
>        private static final String JMS_CORRELATION_ID = "JMSCorrelationID";
>        private static final String CAUSE_IS = " CAUSE IS: ";
>
>        public void respond(Exchange exchange) {
>
>                ReceiptList receiptList = new ReceiptList();
>                receiptList.setAdvisoryExceptionMessage(true);
>                receiptList.setDateSubmitted( new Date() );
>
>                org.apache.camel.Message inMsg = exchange.getIn();
>
>                if(log.isDebugEnabled()) log.debug("&&& got message of type: " 
> +
> inMsg.getClass().getName());
>
>                Exchange inMsgExchange = inMsg.getExchange();
>
>                String jmsCorrelationId = null;
>                jmsCorrelationId = (String) 
> inMsg.getHeader(JMS_CORRELATION_ID);
>                if(log.isDebugEnabled()) log.debug("&&&
> inMsg.getHeader(JMS_CORRELATION_ID) is: " + jmsCorrelationId  );
>
>                receiptList.setJmsMessageID( jmsCorrelationId );
>
>                Exception exception = (Exception)
> inMsg.getExchange().getProperty(Exchange.EXCEPTION_CAUGHT);
>                if( exception != null )
>                {
>                        StringBuilder sb = new StringBuilder();
>                        sb.append( exception );
>                        if( exception.getCause() != null )
>                        {
>                                sb.append( CAUSE_IS );
>                                sb.append( exception.getCause() );
>                        }
>                        receiptList.setException( sb.toString() );
>                }
>
>                receiptList.setCamelRoute( exchange.getFromRouteId() );
>                receiptList.setMessageBody( (String) 
> exchange.getIn().getBody() );
>
>                exchange.getOut().setBody( receiptList.toXml() );
>
>        }
>
> }
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Missing-properties-on-exception-tp4775029p4778846.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to