h2. 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.
h3. 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}
cd examples/camel-example-spring-xquery
mvn camel:run
{code}
You should now see the generated files in the *target/outputFiles* directory which are the transformed messages read from the JMS queue.
h3. Code walk through
What this does is boot up the Spring ApplicationContext defined in the file [META-INF/spring/camelContext.xml|http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-xquery/src/main/resources/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 |http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-xquery/src/main/resources/META-INF/spring/camelContext.xml] 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...
{snippet:id=example|lang=xml|url=camel/trunk/examples/camel-example-spring-xquery/src/main/resources/META-INF/spring/camelContext.xml}
|