| h1. servicemix-camel |
| |
| h2. Overview |
| The servicemix-camel component provides support for using Apache Camel to provide a full set of Enterprise Integration Patterns and flexible routing and transformation in both Java code or Spring XML to route services on the Normalized Message Router. |
| |
| h3. Namespace and camel-context.xml |
| When creating a servicemix-camel service unit, we reuse the default Camel namespace {{http://camel.apache.org/schema/spring}}. |
| |
| This is an example {{camel-context.xml}} which uses the Spring DSL to define the Camel routes |
| {code} |
| <?xml version="1.0" encoding="UTF-8"?> |
| <beans xmlns="http://www.springframework.org/schema/beans" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://www.springframework.org/schema/beans |
| http://www.springframework.org/schema/beans/spring-beans-2.0.xsd |
| http://camel.apache.org/schema/spring |
| http://camel.apache.org/schema/spring/camel-spring.xsd"> |
| |
| <camelContext xmlns="http://camel.apache.org/schema/spring"> |
| <route> |
| <!-- route defined in the Spring DSL --> |
| </route> |
| </camelContext> |
| |
| </beans> |
| {code} |
| |
| It is also possible to use the Java DSL inside a servicemix-camel service unit by referring to the package that contains the {{RouteBuilder}} classes. An example: this {{camel-context.xml}} file will activate all routes defined by {{RouteBuilder}}s in the {{org.apache.servicemix.example.camel}} package. |
| {code} |
| <?xml version="1.0" encoding="UTF-8"?> |
| <beans xmlns="http://www.springframework.org/schema/beans" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation=" |
| http://www.springframework.org/schema/beans |
| http://www.springframework.org/schema/beans/spring-beans-2.0.xsd |
| http://camel.apache.org/schema/spring |
| http://camel.apache.org/schema/spring/camel-spring.xsd"> |
| |
| <camelContext xmlns="http://camel.apache.org/schema/spring"> |
| <packages>org.apache.servicemix.examples.camel</packages> |
| </camelContext> |
| |
| </beans> |
| {code} |