Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Spring XQuery ExampleThe Spring XQuery example uses no Java code; its configured purely using a Spring XML configuration file. It parsers some files from a directory, transforms them using XQuery then sends them to a message queue. To make it easy to look at the generated files, we also have another route which consumes from the JMS queue and writes them to an output directory. Running the exampleTo run the example we use the Camel Maven Plugin. For example from the source or binary distribution the following should work cd examples/camel-example-spring-xquery mvn camel:run You should now see the generated files in the target/outputFiles directory which are the transformed messages read from the JMS queue. Code walk throughWhat this does is boot up the Spring ApplicationContext defined in the file META-INF/spring/camelContext.xml on the classpath. This is a regular Spring XML document which uses the Camel Xml Configuration to configure a CamelContext. Also note at the end of this XML example file we explicitly configure the ActiveMQ component with details of how to connect to the broker. The main part of the Spring XML file is here... Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<camelContext xmlns="http://camel.apache.org/schema/spring"> <!-- lets parse files, transform them with XQuery and send them to JMS --> <route> <from uri="file:src/data?noop=true"/> <log message="Transforming input file ${header.CamelFileName}"/> <to uri="xquery:myTransform.xquery"/> <to uri="jms:MyQueue"/> </route> <!-- now lets write messages from the queue to a directory --> <route> <from uri="jms:MyQueue"/> <log message="Writing output file ${header.CamelFileName}"/> <to uri="file:target/outputFiles"/> </route> </camelContext> <!-- lets configure the default ActiveMQ broker URL --> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <property name="connectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost?broker.persistent=false"/> </bean> </property> </bean> |