| h2. Deploy as a plain Spring XML file |
| ServiceMix ${servicemix.version} supports the deployment of plain Spring XML files, automatically creating and starting the Spring ApplicationContext from the XML file. |
| |
| In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the {{$SERVICEMIX_HOME/deploy}} folder: |
| {pygmentize:lang=xml} |
| <?xml version="1.0" encoding="UTF-8"?> |
| <beans xmlns="http://www.springframework.org/schema/beans" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xmlns:camel="http://camel.apache.org/schema/spring" |
| xsi:schemaLocation=" |
| http://www.springframework.org/schema/beans |
| http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
| http://camel.apache.org/schema/spring |
| http://camel.apache.org/schema/spring/camel-spring-${camel.version}.xsd"> |
| |
| <camelContext xmlns="http://camel.apache.org/schema/spring"> |
| <!-- add Camel routes, interceptors,... here --> |
| </camelContext> |
| |
| </beans> |
| {pygmentize} |
| |
| h3. An example |
| Just create a new XML file in the deploy folder with the code below to start a route to copy files from one directory to another. |
| {pygmentize:lang=xml} |
| <?xml version="1.0" encoding="UTF-8"?> |
| <beans xmlns="http://www.springframework.org/schema/beans" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xmlns:camel="http://camel.apache.org/schema/spring" |
| xsi:schemaLocation=" |
| http://www.springframework.org/schema/beans |
| http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
| http://camel.apache.org/schema/spring |
| http://camel.apache.org/schema/spring/camel-spring-${camel.version}.xsd"> |
| |
| <camelContext xmlns="http://camel.apache.org/schema/spring"> |
| <route> |
| <from uri="file:input"/> |
| <log message="Copying ${file:name} to the output directory"/> |
| <to uri="file:output"/> |
| </route> |
| </camelContext> |
| |
| </beans> |
| {pygmentize} |