Spring XQuery Example
The 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 example
To run the example we use the Camel Maven Plugin.
For example from the source or binary distribution the following should work
Code Block |
---|
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 through
What 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...
Wiki Markup |
---|
{snippet:id=example|lang=xml|url=camel/trunk/examples/camel-example-spring-xquery/src/main/resources/META-INF/spring/camelContext.xml} |
...