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.

In this case, we will use a Blueprint XML file to start your Camel routs. To do so, the Blueprint XML files have to be included in the bundle inside the OSGI-INF/blueprint directory.

+ <bundle classes, incl. your RouteBuilder>
|- META-INF
|  |- MANIFEST.MF
\- OSGI-INF
   \- blueprint
      \- camel-context.xml

As soon as the bundle becomes Active, the Blueprint extender will create the Blueprint container starting your Routes.

Example: Referring to Java or Scala RouteBuilder classes

If your RouteBuilder classes have been defined in the org.apache.servicemix.manual.camel package, the file would look like this:

<?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>

Example in the distribution

Another example for using this deployment option can be found in the camel-blueprint example that is shipped with Apache ServiceMix.