Issue with Camel Velocity Component Output where headers are cleaned out after processing
Issue
- Facing an issue in using
CamelVelocitycomponent where all the existing headers are cleaned out once exchange is processed byVelocitycomponent. - Sequence Workflow is below
- Accept a file over file endpoint (
E:\In) and send to aJMSqueue for further processing.. - From JMS queue, call
xsltcomponent (available inE:\XSLT) to do transformation and then hand over to velocity component (available inE:\XSLT) to create a wrapper response. - Finally write the response from
velocityto a file (E:Out).
- Accept a file over file endpoint (
<camelContext id="xslt-velocity-test-adaptor" xmlns="http://camel.apache.org/schema/spring">
<route id="File_JMS" startupOrder="1" autoStartup="true" streamCache="true">
<from uri="file:///E:/In"/>
<to uri="activemqLocal:queue:TEST.IN"/>
</route>
<route id="JMS_File" startupOrder="2" autoStartup="true" streamCache="true">
<from uri="activemqLocal:queue:TEST.IN"/>
<convertBodyTo type="java.lang.String" charset="UTF-8"/>
<to uri="activemqLocal:queue:TEST.TEMP"/>
<to uri="direct:xsltProcessor"/>
<to uri="direct:fileOut"/>
</route>
<route id="xslt_processor" startupOrder="3" autoStartup="true" streamCache="true">
<from uri="direct:xsltProcessor"/>
<doTry>
<to uri="activemqLocal:queue:TEST.TEMP"/>
<to uri="xslt:file:///E:/XSLT/test.xsl?allowStAX=false"/>
<to uri="activemqLocal:queue:TEST.TEMP"/>
<to uri="velocity:file:///E:/XSLT/test.vm"/>
<doCatch>
<exception>org.apache.camel.RuntimeTransformException</exception>
<handled>
<constant>true</constant>
</handled>
<setHeader headerName="Exception">
<simple>XSLT Transformation failed with ${exception.message}</simple>
</setHeader>
<log message="Error in message processing. Exception message is: ${exception.message}" loggingLevel="ERROR" logName="com.test" />
<to uri="activemqLocal:queue:TEST.ERROR"/>
</doCatch>
</doTry>
</route>
<route id="file_out" startupOrder="4" autoStartup="true" streamCache="true">
<from uri="direct:fileOut"/>
<to uri="activemqLocal:queue:TEST.TEMP"/>
<recipientList>
<simple>file:///${in.header.CamelFileParent}/?fileName=../Out/${in.header.CamelFileNameOnly}</simple>
</recipientList>
</route>
</camelContext>
Environment
- Red Hat JBoss Fuse
- 6.0.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
