Claus I am using ActiveMQ 5.4.2 with its native Camel 2.4.0.
On Thu, Sep 8, 2011 at 8:18 AM, Claus Ibsen-2 [via Camel] < [email protected]> wrote: > What version of Camel are you using? > > And what JMS broker? > > On Wed, Sep 7, 2011 at 5:06 PM, pkleczka <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4782588&i=0>> > 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: [hidden email]<http://user/SendEmail.jtp?type=node&node=4782588&i=1> > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/Missing-properties-on-exception-tp4775029p4782588.html > To unsubscribe from Missing properties on exception, click > here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4775029&code=cGtsZWN6a2FAZ21haWwuY29tfDQ3NzUwMjl8OTY3NjE0OTg2>. > > -- View this message in context: http://camel.465427.n5.nabble.com/Missing-properties-on-exception-tp4775029p4782887.html Sent from the Camel - Users mailing list archive at Nabble.com.
