Gert Vanthienen's blog

Tuesday, September 23, 2008

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:

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: , ,

Thursday, September 11, 2008

What does *DTAQ mean to a Camel?

If you ever worked with an AS/400 system (aka iSeries, System i, IBM i on IBM Power Systems, ...), you probably know what a *DTAQ is all about. For those that don't: a data queue is a native object on the AS/400 that allow you to set up fast and asynchronous communication between jobs and machines.

Apache Camel now has a component to support AS/400 data queues. An example: to read a message of a data queue named REQUESTS in library ERP and send it to RESPONSES queue, all you have to code is

<route>
  <from uri="jt400://myuser:secretpwd@as400_host/qsys.lib/erp.lib/requests.dtaq"/>
  <to uri="jt400://myuser:secretpwd@as400_host/qsys.lib/erp.lib/responses.dtaq"/>
</route>


Moving messages from one queue to the other isn't that spectacular, but you can just as easily replace the to uri to send the message using FTP, HTTP, mail or use any of the other components available in Camel.

It's time to start leveraging all the good code that is available on AS/400 systems all over the world and make that ride the Camel too.

Labels: