ServiceMix Kernel and Camel
Guillaume already announced the release of ServiceMix Kernel 1.0.0 on his blog. We use it as the base for building SMX 4, but you can add any behavior to it by just installing a few bundles.
An example: to convert ServiceMix Kernel into an Apache Camel route container, we just type these three commands in the kernel's console:
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.
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>
Labels: Camel, OSGi, ServiceMix
6 Comments:
I'm a newbe of smx(4), sorry if my question is trivial. but how can I deploy/install camel routes created with maven (http://activemq.apache.org/camel/creating-a-new-spring-based-camel-route.html)? with "mvn install" the system creates .jar files...
By Matteo, At September 25, 2008 at 4:43 PM
Matteo,
We have an example called 'camel-example-osgi' on how to build an OSGi bundle with a Camel route with Maven in the Camel distribution. You can install this example directly from the ServiceMix Kernel console with this command:
'osgi install -s mvn:org.apache.camel/camel-example-osgi/1.4.0'
Basically, you put the 'camel-context.xml' containing the routes to the 'src/main/resources/META-INF/spring' directory in your Maven project. This way, ServiceMix Kernel will find the Spring configuration file inside the bundle upon deployment. You can also add other beans you want to use in your Camel route to the same JAR file.
Regards,
Gert
By Gert Vanthienen, At September 25, 2008 at 9:23 PM
Hi Matteo.
we're in the process of writing a series of articles (in italian language) on how to make FUSE
components (aka enterprises version of Apache CXF, ActiveMQ, Camel and ServiceMix) work together.
the first article has been published
(http://www2.mokabyte.it/cms/article.run?articleId=4CF-9LD-DYQ-SH5_7f000001_10911033_21a00f1e)
and the next two will follow.
you could be interested in the last one, that will be published on the 15th
of November, where the deployment of Camel on ServiceMix(4) will be explained.
Cheers,
Paolo.
By Paolo Palazzini, At September 29, 2008 at 2:21 PM
I'd liek to use the latest stable release of camel (1.5.0) but it doen't work..
osgi install -s mvn:org.apache.camel/camel-core/1.5.0
ERROR BundleException: Unresolved package in bundle 30: package; (package=javax.xml.bind)
any suggestion?
Thanks in advance
Matteo
By Matteo, At November 3, 2008 at 1:55 PM
Matteo,
We have a ServiceMix bundle to provide the JAXB API. You can install that on ServiceMix Kernel with
mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.1.0
Regards,
Gert
By Gert Vanthienen, At November 3, 2008 at 3:16 PM
A more complete list of osgi bundles is listed at http://servicemix.apache.org/SMX4KNL/1-quick-start.html
. If you replace 1.4.0 with 1.5.0 it seems to work.
By Unknown, At December 18, 2008 at 10:24 AM
Post a Comment
Subscribe to Post Comments [Atom]
<< Home