You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Run Camel With ServiceMix Kernel

Apache ServiceMix Kernel is a small OSGi based runtime which provides a lightweight container onto which various bundles can be deployed. Now you can deploy your route rule into it to leverage the power of OSGi.

An example: to convert ServiceMix Kernel into an Apache Camel route container, we just type these three commands in the kernel's console:

osgi install -s mvn:org.springframework/spring-tx/2.5.5
osgi install -s mvn:org.apache.camel/camel-core/1.4.0
osgi install -s mvn:org.apache.camel/camel-spring/1.4.0

This will get the bundles from a local or remote Maven repository, install and start them. Once this is done, you can just create a simple XML file containing the route definitions in the deploy and kernel's file monitor will install and deploy them. You can check the log file with the log d command to see the route in action.

<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.5.xsd
       http://activemq.apache.org/camel/schema/spring
         http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <route>
      <from uri="timer://myTimer?fixedRate=true&period=2000"/>
      <to uri="log:demo?showBodyType=false"/>
    </route>
  </camelContext>

</beans>
  • No labels