blob: a8c73c0718cd7be1d664b38f8fa572cd25dbc50a [file] [log] [blame]
h2. Deploy as an OSGi bundle
Using an OSGi bundle to deploy your Camel routes allows you to use the Java or Scala DSL for defining your routes. The routes are still being started by a Spring or Blueprint XML file, which is included inside the OSGi bundle.
h3. Using Spring
When using Spring to start your Camel routes, you include your Spring XML file (e.g. {{camel-context.xml}}) in the {{META-INF/spring}} folder inside your bundle. After the bundle has been activated, the Spring DM extender will find, create and start your Spring ApplicationContexts.
{noformat}
+ <bundle classes, incl. your RouteBuilder>
\- META-INF
|- MANIFEST.MF
\- spring
\- camel-context.xml
{noformat}
Example: If your RouteBuilder classes have been defined in the {{org.apache.servicemix.manual.camel}} package, the file would look like this:
{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">
<package>org.apache.servicemix.manual.camel</package>
</camelContext>
</beans>
{pygmentize}
h3. Using Blueprint
When using Blueprint to start your Camel routes, the Blueprint XML files have to be included in the bundle inside the {{OSGI-INF/blueprint}} directory.
{noformat}
+ <bundle classes, incl. your RouteBuilder>
|- META-INF
| |- MANIFEST.MF
\- OSGI-INF
\- blueprint
\- camel-context.xml
{noformat}
Example: If your RouteBuilder classes have been defined in the {{org.apache.servicemix.manual.camel}} package, the file would look like this:
{pygmentize:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<package>org.apache.servicemix.manual.camel</package>
</camelContext>
</blueprint>
{pygmentize}