tag:blogger.com,1999:blog-22007078152817039492024-02-07T05:10:53.824+01:00Gert Vanthienen's blogCamel, Karaf and ServiceMixGert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-2200707815281703949.post-26147286287319360012013-04-23T13:34:00.002+02:002013-04-23T15:19:04.036+02:00FuseByExample<p>A few weeks ago, our first <a href="http://www.jboss.org/products/fuse">Red Hat JBoss Fuse</a> release was completed. As with previous releases, this comes with a few examples that show you how to build e.g. a content-based routers or a JAX-RS web service. These examples are all very simple and focused on single technology.</p>
<p>In real life however, things often get quite a bit more complicated than what these examples are showing you. Based on their experience with customers, people like <a href="http://cmoulliard.blogspot.com/">Charles Mouillard</a>, <a href="http://scottcranton.blogspot.com/">Scott Cranton</a>, <a href="http://www.jakubkorab.net/">Jakub Korab</a> and <a href="http://sully6768.blogspot.com/">Scott England-Sullivan</a> have been creating a set of more elaborate example projects on GitHub.</p>
<p><a href="https://github.com/FuseByExample">FuseByExample</a> is the name of the GitHub organisation where all these projects live. If you go there, you'll find a dozen examples that show you how to implement things like transactions using Aries' JTA support,using JPA for database access, using web sockets to build more dynamic web front-ends, ...</p>
<p>All of these examples have been updated to work with the new Red Hat JBoss Fuse 6.0 release so if you're taking a look at this new release, be sure to check out the stuff in <a href="https://github.com/FuseByExample">FuseByExample</a> as well to get a better idea of what is possible with this technology. And also, these are GitHub projects so feel free to create pull requests for improvements, bug fixes, ... We love contributions ;)</p>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com1tag:blogger.com,1999:blog-2200707815281703949.post-81889881122817415492011-12-22T16:10:00.004+01:002011-12-22T18:32:20.865+01:00Apache ServiceMix 4.4.0<p>After a few weeks of testing builds, ironing out the final issues, doing the release builds and running the actual release votes, I'm very glad to be able to send the announcement mails for two new Apache ServiceMix releases to our mailing lists today.</p>
<p>Highlights in the new <a href="http://servicemix.apache.org/downloads/servicemix-4.4.0.html">Apache ServiceMix 4.4.0</a> release include:
<ul>
<li>new packaging options (cfr. <a href="http://gertvanthienen.blogspot.com/2011/11/new-packaging-options-for-servicemix.html">my previous blog post</a>)</li>
<li>upgrade to Apache ActiveMQ 5.5.1</li>
<li>upgrade to Apache Camel 2.8.3</li>
<li>upgrade to Apache CXF 2.4.4</li>
<li>upgrade to Apache Karaf 2.2.4</li>
</ul>
</p>
<p>As part of this release cycle, we also did a new <a href="http://servicemix.apache.org/downloads/servicemix-3.4.0.html">Apache ServiceMix 3.4.0</a> release, which delivers the same dependency upgrades to our existing 3.x user base</p>
<p>Together with this release, we also switched to using <a href="http://scalate.fusesource.org/">Scalate</a> for the main website as well as the documentation pages. With these new pages, we aim to make it easier for people to get started with Apache ServiceMix and all the other projects we embed.</p>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-81652815731428837792011-11-04T01:58:00.000+01:002011-11-23T23:33:20.335+01:00New packaging options for ServiceMix<p>A while ago, <a href="http://iocanel.blogspot.com/">Ioannis Canellos</a> added a few new packaging options to the upcoming Apache ServiceMix 4.4.0 release to better reflect these recommendations. Our upcoming Apache ServiceMix 4.4.0 release will have 4 different assembly types ...</p>
<p>Our default assembly (called <tt>apache-servicemix</tt>) no longer has the NMR or the JBI support preinstalled. You can still install those as optional features, but the focus is on ActiveMQ, Camel and CXF instead. This is the set of technologies we recommend new users to start with, so it makes sense to have our default assembly reflect these recommendations.</p>
<p>With this default assembly, installing the optional features will download the additional bundles required for that feature. If you're running Apache ServiceMix on a server that does not have direct access to the internet, this is not very convenient. That's why we also have a full distribution now (called <tt>apache-servicemix-full</tt>) that has all the bundles sitting ready in the <tt>system</tt> folder for quick and offline installation.</p>
<p>If you're an existing NMR or JBI user, the <tt>apache-servicemix-jbi</tt> distribution builds on top of the default assembly and adds JBI and NMR support. It also comes with all the existing JBI components from earlier versions of Apache ServiceMix.</p>
<p>And finally, the <tt>apache-servicemix-minimal</tt> contains all the configuration and features definitions that come with Apache ServiceMix, but with none of the features preinstalled. This allows you to install just those features that your project requires.</p>
<p>P.S. We now have all the dependencies for Apache ServiceMix 4.4.0 available and are just fixing a few last things so expect one of my next blog posts to be about this new release</p>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-30235966935967080012011-10-12T13:59:00.004+02:002011-10-12T14:14:54.887+02:00It's been a while...<p>It's been quite a while since I have been blogging and, now that the school year is well underway and things are getting a bit more quiet around the house, I intend to start posting a bit more regularly again. Just some random picks out of what I have been doing the past year instead of blogging...<br /><ul><br /><li>In January, I was really honored by the invitation to become an Apache Software Foundation Member.</li><br /><li>In March, there was a <a href="http://www.bejug.org/confluenceBeJUG/display/BeJUG/Scalate+and+Lift">talk about Scalate</a> for BeJUG. We also released Apache ServiceMix 4.3.0 that month.</li><br /><li>Over the summer, we did some redecorating in the house - what was supposed to be a simple change to the electrical wiring, quickly ended up being almost two weeks of hacking walls, adding and removing outlets, plastering, painting, …</li><br /><li>A few weeks ago, we went on a weekend vacation with the kids at the seaside and it just happened to be the warmest October weekend in decades</li><br /></ul></p><br /><p>At the <a href="http://fusesource.com">FuseSource</a> side, we did several <a href="http://fusesource.com/products/enterprise-servicemix/">FUSE ESB</a> releases this year (starting with FUSE ESB 4.3.1-fuse and just did FUSE ESB 4.4.1-fuse a few weeks ago) so I spent quite a bit of time doing release work and even now I'm again working on getting the Apache codebase ready for an Apache ServiceMix 4.4.0 release. Anyway, I'm hoping to be able to tell you a bit more about that in one of the next blog posts. </p>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-9940655730210745382010-10-11T13:54:00.010+02:002010-10-11T15:01:29.609+02:00Traits in the Camel Scala DSLWhen using the Java DSL for Camel, you can create a custom RouteBuilder class which defines common elements for all your routes (e.g. standardized error handling). Since you're only able to inherit from a single class, great care must be taken in which common route elements are being added to the parent class.<br /><br />The Scala DSL allows you to extract those common route elements into traits, which can be mixed into the RouteBuilder in more flexible ways. Consider the scenario where we have two ways we do our error handling: we either want to write a message to the error log or we want to send the message into an error queue.<br /><br />We can model this by writing two Scala traits, defining the <code>org.apache.camel.scala.dsl.RouteBuilder</code> class as the trait's self type:<br /><pre class="brush: scala"><br />trait ErrorQueue { self: RouteBuilder =><br /> handle[Exception] {<br /> log("Sending ${id} to error queue")<br /> to("seda:errors")<br /> }<br />}</pre><br />and<br /><pre class="brush: scala"><br />trait ErrorLog { self: RouteBuilder =><br /><br /> handle[Exception] {<br /> log("Sending ${id} to error log")<br /> to("log:errors")<br /> }<br /><br />}</pre><br /><br />Afterwards, we can just add the implementation we want in our own RouteBuilder using a simple with clause. <br /><pre class="brush: scala"><br />class MyRouteBuilder extends RouteBuilder<br /> with ErrorLog {<br /><br /> //rest of the route goes here<br /><br />}</pre><br /><br />Just replace the <code>with ErrorLog</code> by <code>with ErrorQueue</code> to pick another error handler implementation. And because you can add multiple traits to the same class, this approach allows you to define lots of common route elements and just mix and match those that you need. <br /><br />Happy Camel riding with the Scala DSL!!Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com1tag:blogger.com,1999:blog-2200707815281703949.post-7744903162433185772010-07-03T23:35:00.008+02:002010-07-04T00:28:35.758+02:00Camel async routing in ServiceMixUntil recently, servicemix-camel did not allow asynchronous interaction with the NMR. Every MessageExchange was being sent using sendSync(), causing the calling thread to wait for the MessageExchange to finish. <br /><br />Let's take a look at this set of Camel routes:<br /><code><br />from("jbi:endpoint:urn:test:service:endpoint1")<br /> .to(""jbi:endpoint:urn:test:service:endpoint2");<br />from("jbi:endpoint:urn:test:service:endpoint2")<br /> .to(""jbi:endpoint:urn:test:service:endpoint3");<br />from("jbi:endpoint:urn:test:service:endpoint3")<br /> .to(""jbi:endpoint:urn:test:another_service:endpoint");<br /></code><br /><br />When sending an exchange to endpoint 1, the diagram below shows how this invocation will cause three threads to be waiting until the entire flow ends.<br /><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibQ1INiFiluLmYPmIOghziWEn8SWBclzVJHBqY1zthopuum3gChXB9pWXf7Zme5pYX50bDtDZH9gh0YdT83asLBBLrFeD-nDfXeatoDXYdBWUDqHeVEXp4BIngFaVdx9ZJduWfwuw5IGM/s1600/sendSync.png" /><br /><br />For the upcoming Camel 2.4.0 release, <a href="http://davsclaus.blogspot.com/">Claus Ibsen</a> has been working hard to add fully async routing to Camel again. The servicemix-camel and camel-nmr components have already been upgraded to leverage his hard work, because this improvement completely changes the picture for JBI and NMR integration.<br /><br />As you can see below, the threads are now no longer waiting, but are available to pick up new work while the initial flow of MessageExchanges is still ongoing.<br /><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1ZFflpUhWbO96YqQf-_j20vkBG9PTpWYpgSumYR0V8W6K-K5bVBEanVxLMzScTzhvipHGkmIrzj_O600T1JKHR9KAb924v8VZrQeKi5lSxhHMqS88GkMdYffaRXpTrBFk0A-QLqUAp4M/s1600/send.png" /><br /><br />If you're using Camel inside ServiceMix, make sure you pick up the next version of <a href="http://servicemix.apache.org/home.html">Apache ServiceMix</a> or <a href="http://fusesource.com/products/enterprise-servicemix4/">FUSE ESB</a> to benefit from these scalability improvements.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com4tag:blogger.com,1999:blog-2200707815281703949.post-63473886553363146312010-03-15T11:48:00.004+01:002010-03-15T15:43:08.789+01:00When JBI meets OSGi, part 1In ServiceMix 4.2.0, you'll be able to deploy your existing JBI artifacts alongside OSGi bundles. <br /><br />In a mixed environment like that, you might run into the situation where you want to access a class defined in an OSGi bundle from within your existing JBI SU. To allow you to that without having to add the JAR to your SU (effectively adding a second definition of the same class to the container), you can now reference an OSGi bundle as a shared library directly from your SU xbean.xml file using <tt>osgi:<bundle symbolic name></tt>.<br /><br />An example: you have a nice Camel InterceptStrategy implementation in an OSGi bundle and you're using that in a lot of your OSGi based Camel routes. You can now reuse the same code in a JBI SU for servicemix-camel by adding this snippet to your xbean.xml or camelContext.xml<br /><br /><code><br /> <classpath><br /> <library>osgi:my.intercept.bundle.symbolic.name</library><br /> </classpath><br /></code>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com2tag:blogger.com,1999:blog-2200707815281703949.post-36075880401448746362010-01-26T14:48:00.005+01:002010-01-26T15:27:46.781+01:00Scala on KarafOver the holiday season, I had a bit of spare time to work the <a href="http://camel.apache.org/scala-dsl.html">Camel Scala DSL</a> again. While doing this, I realized that it was a bit too hard to actually use the Scala DSL on Karaf (need to configure Maven to use both the Scala plugin and the Felix bundle plugin to build the deployable jar).<br /><br />Wouldn't it be nice to just drop a Scala source file in Karaf's deploy folder and get everything done automatically? With this idea in mind, I started a new project called <a href="http://slang.fusesource.com">Slang</a> on the <a href="http:/forge.fusesource.com">FUSE Forge</a> to add support for additional languages to Karaf.<br /><br />You can now try out a first shot at the Scala language support - you still have to build it yourself at the moment, but once you installed the feature on Karaf, you can just drop this source file in the deploy folder:<br /><br /><code><br />import org.fusesource.slang.scala.common.ScalaActivator<br /><br />package org.fusesource.slang.scala.examples<br /><br />class Activator extends ScalaActivator {<br /> <br /> publish(new HelloWorldServiceImpl())<br /> .as[HelloWorldService]<br />}<br /> <br />class HelloWorldServiceImpl extends HelloWorldService {<br /> def hello = println("Saying hello")<br />}<br /><br />trait HelloWorldService {<br /> def hello<br />}<br /></code><br /><br />The result will be a bundle on Karaf that exports the HelloWorldService interface and has published the HelloWorldServiceImpl in the OSGi Service Registry. Next on my todo list is to actually get it to run the Camel route built in the Scala DSL this way.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com1tag:blogger.com,1999:blog-2200707815281703949.post-11817566921691531932009-10-20T19:29:00.002+02:002009-10-20T21:02:51.237+02:00Speaking at TSSJS Europe<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.javasymposium.com"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 125px; height: 125px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivb9uyk1nxmw51nKstzywn_yzxJHoRRndA1RKSx8Mk71FLk3dL10-hFW4Xa3HRlux0nBRhzACFDgedKnZIgUKc1UQwTCgxMS8lJ-sY6F_tHehrVvNTv6nG4EjQyQbNzTofmCQmCVArGtg/s320/mail.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5394735973506596498" /></a><br /><br />Next week, I'll be in Prague at TheServerSide Java Symposium-Europe to talk about Apache ServiceMix 4 and Apache Felix Karaf - we'll take a look at the architecture and design used in ServiceMix 4 and you'll learn how you can build your own container starting with Karaf and adding only those components you need for your own project.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-73378137449637725632009-05-25T09:23:00.003+02:002009-05-25T09:36:57.122+02:00FUSE Open Source Community DayA few weeks ago Progress organized the FUSE Open Source Community Day in their offices in Rotterdam. This is just a quick note to mention that the presentation slides of that day are now available online at <a href="http://fusesource.com/fuse/fuse-osc-day051409/">http://fusesource.com/fuse/fuse-osc-day051409/</a>.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com2tag:blogger.com,1999:blog-2200707815281703949.post-28979612696995181602009-03-28T10:38:00.003+01:002009-03-28T10:48:31.545+01:00ServiceMix 4.0.0 released<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF2QWeU_tD1v8SpQJUARsK6o7h3pWTB1SxwRtyyRFuvMRBIioFQbs52ooAczLJzDXeJftME7CdnziBO0IgwTsXx2cshhDH06lx2G4vv2e_ksBB9bq6GR4gsygIwVwmwN2TRByWL2kfm3M/s1600-h/smx4.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 261px; height: 287px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF2QWeU_tD1v8SpQJUARsK6o7h3pWTB1SxwRtyyRFuvMRBIioFQbs52ooAczLJzDXeJftME7CdnziBO0IgwTsXx2cshhDH06lx2G4vv2e_ksBB9bq6GR4gsygIwVwmwN2TRByWL2kfm3M/s320/smx4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5318170943350000786" /></a><br />Apache ServiceMix 4.0 is the first release of our OSGi based integration platform. <br /><br />It includes two major components:<br />* <a href="http://servicemix.apache.org/kernel">Apache ServiceMix Kernel</a>: an OSGi runtime with a lot of extra features (SSH connectivity, provisioning enhancements, Spring integration, ...)<br />* <a href="http://servicemix.apache.org/nmr">Apache ServiceMix NMR</a>: an OSGi based NMR and JBI container, which also comes with a new clustering engine ready for enterprise deployment<br /><br />In addition, ServiceMix 4.0 also ships with enhanced ActiveMQ, Camel and CXF integration as well as a whole set of examples to let you leverage this functionality. We also have out-of-the-box support for deploying and running web applications, so they can run together with everything else in the same container. And off course, all you favourite JBI components are now available in ServiceMix 4.0.0 as well.<br /><br />More information and links to the downloads is available <a href="http://servicemix.apache.org/SMX4/servicemix-400.html">here</a>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-66103634173128555962009-03-24T09:01:00.003+01:002009-03-24T09:23:33.546+01:00Apache ServiceMix BOF at ApacheCon EuropeJust a quick note to announce that there is an Apache ServiceMix BOF scheduled at <a href="http://www.eu.apachecon.com/c/aceu2009/">ApacheCon Europe</a> this week. If you're coming to Amsterdam, join us on Thursday evening at 20:30 in room Matterhorn 3.<br /><br />The full BOF schedule is available at http://wiki.apache.org/apachecon/BirdsOfaFeatherEu09.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-71081260734015073672009-01-13T21:43:00.007+01:002009-01-15T23:23:34.180+01:00A better CBRImplementing a <a href="http://activemq.apache.org/camel/content-based-router.html">content based router in Camel</a> is very simple. However, this also means that the routing rules are hard-coded in the Camel RouteBuilder.<br /><br />Building a more dynamic solution is equally simple with the new <a href="http://activemq.apache.org/camel/recipientlist-annotation.html">@RecipientList</a> annotation. You just create bean with a method that returns a (collection of) endpoints. You can off course use other annotations (like the @XPath annotation) to make your work easier.<br /><pre><br />public class RecipientListService { <br /> @RecipientList<br /> public List<String> getTargets(@XPath("/po/supplier/@id") String id) {<br /> // lookup endpoint(s) in db or config file<br /> }<br />}<br /></pre><br />When using Camel inside ServiceMix, you then register this bean in your camel-context.xml file.<br /><pre><br /><beans><br /> <camelContext>...</camelContext><br /> <br /> <bean id="RecipientListService" class="be.anova.camel.RecipientListService"><br /> <!-- this is plain Spring so you can inject any db, webservice, ... you need --><br /> </bean><br /></beans><br /></pre><br />By using plain Java and a Spring configuration file, we can write any kind of Java code or access any resource (e.g. a database or external config file) to determine the next routing step. This way, we can build a SA that can be reconfigured without redeployment. <br /><br />An example use case? You can now build a generic PO handling SA. Every time a new supplier wants to receive their PO electronically, you just create a SA with the supplier-specific endpoints and add some config and you're done! You can even keep the config and the endpoints together in a single bundle if you're using ServiceMix 4 and leverage the OSGi registry to hold your configuration data.<br /><br />And if you wonder what the Camel route itself looks like, it is a simple as it gets:<br /><pre><br />from("jbi:service:urn:my:service").beanRef("RecipientListService", "getTargets");<br /></pre>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-54112049606006938522008-12-11T15:04:00.004+01:002008-12-11T15:33:09.330+01:00TutorialsOver the last few weeks, two new tutorials have been added to help people get started with ServiceMix and Camel:<br /><ul><br /><li><a href="http://cmouillard.blogspot.com">Charles Mouillard</a> added the first part of a tutorial on how to <a href="http://cwiki.apache.org/confluence/display/CAMEL/tutorial-osgi-camel-part1">build SOA solutions with Camel and OSGi</a></li><br /><li><a href="http://www.nanthrax.net">Jean-Baptiste Onofré</a> created a tutorial that shows you how you can <a href="http://servicemix.apache.org/6-intermediate-using-ejb-inside-servicemix.html">leverage your existing EJBs in ServiceMix using the servicemix-cxf-se component</a>.</li><br /></ul><br />I also had to introduce some people to Apache Maven recently and created <a href="http://www.anova.be/courses/maven">these slides</a>. They are available under a <a href="http://creativecommons.org/licenses/by/2.0/be/deed.en">Creative Commons license</a> so feel free to download and use them as you see fit!Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-33053435566360275622008-11-02T13:54:00.004+01:002008-11-03T15:15:03.004+01:00... and another releaseJust a brief note to help spread the word on the <a href="http://activemq.apache.org/camel">Camel</a> 1.5.0 release. For more details, just check out the <a href="http://activemq.apache.org/camel/camel-150-release.html">release notes</a> or find out what <a href="http://bsnyderblog.blogspot.com/2008/10/new-release-of-apache-camel-now.html">Bruce</a>, <a href="http://davsclaus.blogspot.com/2008/11/camel-150-release.html">Claus</a> or <a href="http://janstey.blogspot.com/2008/10/apache-camel-150-released.html">Jon</a> are saying about it.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-25681743205740331032008-10-30T09:02:00.005+01:002008-11-03T15:14:43.806+01:00Releases, releases, ....The latest ServiceMix release news:<br /><ul><br /><li><a href="http://servicemix.apache.org/servicemix-322.html">ServiceMix 3.2.3</a> is a bugfix release for the 3.2.x series</li><br /><li><a href="http://servicemix.apache.org/servicemix-33.html">ServiceMix 3.3</a> is the new release of our container, using new versions of ActiveMQ, Camel, CXF, Drools, Jetty, Saxon, ...</li><br /><li>there also is <a href="http://servicemix.apache.org/SMX4NMR/servicemix-nmr-100-m3.html">new milestone release</a> of the ServiceMix 4 NMR</li><br /><li>a whole set of OSGi bundles was released: we now have over 60 OSGi-fied artifacts available -- you can find the full list <a href="http://servicemix.apache.org/SMX4/bundles-repository.html">here</a></li><br /></ul>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com1tag:blogger.com,1999:blog-2200707815281703949.post-7196054266579573532008-09-23T22:44:00.008+02:002008-09-24T23:19:20.208+02:00ServiceMix Kernel and Camel<a href="http://gnodet.blogspot.com">Guillaume</a> already announced the release of <a href="http://servicemix.apache.org/SMX4KNL/servicemix-kernel-100.html">ServiceMix Kernel 1.0.0</a> 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.<br /><br />An example: to convert ServiceMix Kernel into an Apache Camel route container, we just type these three commands in the kernel's console:<br /><pre><br />osgi install -s mvn:org.springframework/spring-tx/2.5.5<br />osgi install -s mvn:org.apache.camel/camel-core/1.4.0<br />osgi install -s mvn:org.apache.camel/camel-spring/1.4.0<br /></pre><br />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 <tt>deploy</tt> and kernel's file monitor will install and deploy them. You can check the log file with the <tt>log d</tt> command to see the route in action.<br /><pre><br /><beans xmlns="http://www.springframework.org/schema/beans"<br /> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br /> xsi:schemaLocation="<br /> http://www.springframework.org/schema/beans <br /> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd<br /> http://activemq.apache.org/camel/schema/spring <br /> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"><br /><br /> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"><br /> <route><br /> <from uri="timer://myTimer?fixedRate=true&period=2000"/><br /> <to uri="log:demo?showBodyType=false"/><br /> </route><br /> </camelContext><br /><br /></beans><br /></pre>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com6tag:blogger.com,1999:blog-2200707815281703949.post-85549927180884034452008-09-11T06:58:00.004+02:002008-09-11T07:35:47.953+02:00What 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 <tt>*DTAQ</tt> 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.<br /><br />Apache Camel now has a component to support AS/400 data queues. An example: to read a message of a data queue named <tt>REQUESTS</tt> in library <tt>ERP</tt> and send it to <tt>RESPONSES</tt> queue, all you have to code is<br /><code><br /><route><br /> <from uri="jt400://myuser:secretpwd@as400_host/qsys.lib/erp.lib/requests.dtaq"/><br /> <to uri="jt400://myuser:secretpwd@as400_host/qsys.lib/erp.lib/responses.dtaq"/><br /></route><br /></code><br /><br />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 <a href="http://activemq.apache.org/camel/components.html">components available in Camel</a>. <br /><br />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.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com2tag:blogger.com,1999:blog-2200707815281703949.post-61127739344137820832008-08-01T15:39:00.005+02:002008-08-02T14:16:04.286+02:00ServiceMix 3.2.2 released<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://servicemix.apache.org/images/new-logo.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px;" src="http://servicemix.apache.org/images/new-logo.png" border="0" alt="" /></a><br />We just released <a href="http://servicemix.apache.org/servicemix-322.html">ServiceMix 3.2.2</a> this morning. A lot of bugs were fixed, but it also contains major improvements on the Camel and CXF compents. We also improved the Maven archetypes to include the necessary information for an IDE to use the XSD to provide you with code completion when editing xbean.xml files. <br /><br />Check out the <a href="http://servicemix.apache.org/servicemix-322.html">release notes</a> for all the details!Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-52909550409468032682008-07-24T11:35:00.005+02:002008-08-01T16:25:01.162+02:00Apache Camel 1.4 released<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://activemq.apache.org/camel/download.data/camel-box-v1.0-150x200.png"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 150px;" src="http://activemq.apache.org/camel/download.data/camel-box-v1.0-150x200.png" alt="" border="0" /></a><br /><a href="http://activemq.apache.org/camel">Apache Camel</a> 1.4 was officially released. Only 3.5 months after the previous release, this one includes another 261 new features, bugfixes, ... (including two new components and a first preview of new <a href="http://activemq.apache.org/camel/scala-dsl.html">Scala DSL</a>). Check out the <a href="http://activemq.apache.org/camel/camel-140-release.html">release notes</a>!<br /><br /><a href="http://davsclaus.blogspot.com/">Claus Ibsen</a> also added a second <a href="http://activemq.apache.org/camel/tutorials.html">tutorial</a> to ensure you get started with Camel in no time!Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-44844062806392258242008-06-05T13:47:00.007+02:002008-08-02T14:16:19.599+02:00Unit testing Camel routes for ServiceMixServiceMix allows you to write <a href="http://servicemix.apache.org/integration-testing-in-spring.html">integration tests</a> using the Spring framework. In addition to this, there is a little technique that allows you to write unit tests for the Camel routes you'll use inside ServiceMix as well. Write the core routing logic (in this example: a content based router) in an abstract RouteBuilder class ...<br /><pre><br />public abstract class AbstractRouteBuilder extends RouteBuilder {<br /> <br /> protected static final String DIRECT_ROUTER = "direct:router";<br /> protected static final String DIRECT_SUPPLIER1 = "direct:supplier1";<br /> protected static final String DIRECT_SUPPLIER2 = "direct:supplier2";<br /><br /> public void configure() { <br /> from(DIRECT_ROUTER)<br /> .choice()<br /> .when(xpath("/po/supplier/@id = '3125'"))<br /> .to(DIRECT_SUPPLIER1)<br /> .otherwise()<br /> .to(DIRECT_SUPPLIER2);<br /> }<br />}<br /></pre><br />... and add the JBI endpoint bindings in a separate class, extending the abstract base routing rules.<br /><pre><br />public class JbiRouteBuilder extends AbstractRouteBuilder {<br /> <br /> @Override<br /> public void configure() {<br /> super.configure();<br /> <br /> //adding the JBI bindings<br /> from(DIRECT_SUPPLIER1).to("jbi:service:urn:be:anova:po:supplier1");<br /> from(DIRECT_SUPPLIER2).to("jbi:service:urn:be:anova:po:supplier2");<br /> from("jbi:service:urn:be:anova:po:router).to(DIRECT_ROUTER);<br /> }<br /><br />}<br /></pre><br />This will allow you to write your unit tests using Camel <a href="http://activemq.apache.org/camel/mock.html">mock endpoints</a> by extending the same abstract base class. In the example below, we put one sample XML document for every supplier in a test resources folder and we have a file: endpoint to send both of them through our RouteBuilder for testing.<br /><pre><br />public class RouteBuilderTest extends ContextTestSupport {<br /> <br /> public void testContentBasedRouter() throws Exception {<br /> getMockEndpoint("mock:supplier1").expectedMessageCount(1);<br /> getMockEndpoint("mock:supplier2").expectedMessageCount(1);<br /> assertMockEndpointsSatisifed();<br /> }<br /> <br /> @Override<br /> protected RouteBuilder createRouteBuilder() throws Exception {<br /> return new AbstractRouteBuilder() {<br /> @Override<br /> public void configure() {<br /> super.configure();<br /> from(AbstractRouteBuilder.DIRECT_SUPPLIER1).to("mock:supplier1");<br /> from(AbstractRouteBuilder.DIRECT_SUPPLIER2).to("mock:supplier2");<br /> from("file:src/test/resources/be/anova/smx/purchase?noop=true")<br /> .to(DIRECT_ROUTER);<br /> }<br /> };<br /> }<br />}<br /></pre>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com2tag:blogger.com,1999:blog-2200707815281703949.post-86454620562714417242008-05-27T15:31:00.004+02:002008-05-27T15:45:55.867+02:00Sending HTTP response code in ILE RPGWe (<a href="http://wyerstim.blogspot.com/">Tim Wyers</a> and I) just spend a few hours to find out how to send an HTTP response code from an ILE RPG CGI program on System i. From the documentation provided by IBM, it looked like the <tt>QzhbCgiUtils</tt> API was the way to go, but we ended up with a this very simple solution: If you just write <tt>Status: 404 Not found</tt> to standard out, the HTTP server will translate that into the <tt>HTTP/1.1 404 Not found</tt> response code.<br /><pre><br />d WriteStdout pr ExtProc('QtmhWrStout')<br />d 65535a Const Options(*Varsize) //data variable<br />d 9b 0 Const //length of data<br />d 16a Options(*Varsize) //error struct<br />d/Copy Qsysinc/Qrpglesrc,Qusec<br />/free<br /> WriteStdout('Status: 404 Not Found' + X'15': 25: Qusec);<br /> WriteStdout('Content-type: text/html'+X'15'+X'15': 27: Qusec);<br /> WriteStdout('<html\><body>Page not found</body></html>': 29: Qusec);<br /> Return;<br />/end-free<br /></pre>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com2tag:blogger.com,1999:blog-2200707815281703949.post-69115917527813919222008-05-16T10:50:00.002+02:002008-05-16T11:08:58.626+02:00NTP on SuSE 9.3I just spent a few hours trying to get an NTP server working on SuSE 9.3. Correction: I spent most of this time getting the <tt>SuSEfirewall2</tt> to allow NTP traffic. Apparently, this can't be configured through YaST in SuSE 9.3 but you have to edit <tt>/etc/sysconfig/SuSEfirewall2</tt> and add these two parameters:<br /><pre><br /># Obviously, you have to configure the external interface to allow NTP UDP datagrams<br />FW_SERVICES_EXT_UDP="ntp"<br /># ...but you also need this to get the NTP server working<br />FW_ALLOW_INCOMING_HIGHPORTS_UDP="ntp"<br /></pre>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-42192897582111032562008-04-25T11:36:00.006+02:002008-08-16T07:43:12.316+02:00Unwrapping the wrapperWhen we started development on the Scala DSL for Camel, we were using implicit conversion to convert a Java DSL type into a Scala DSL type like this:<br /><code><br />implicit def enrichChoice(choice: ChoiceType) = new RichChoiceType(choice)<br /></code><br />However, when we try to create a nice-looking DSL this way, we run into problems with the explicits-first rule for implicit conversion in Scala sometimes: methods on the original Java DSL type would take precedence over the 'new' Scala DSL methods. <br /> <br />We actually wanted the behavior to be the other way around: prefer the Scala DSL methods and only fail back to the Java DSL when necessary. Just to whet your appetite for Scala, all it takes to implement this is a simple trait... <pre><br />trait Wrapper[T] {<br /> val unwrap : T<br />}<br /></pre> ... implemented on our Scala DSL types ...<br /><code><br />class RichChoiceType(val unwrap: ChoiceType) with Wrapper[ChoiceType]<br /></code><br />... and one equally simple implicit conversion method.<br /><code><br />implicit def unwrap[T](wrapper: Wrapper[T]) = wrapper.unwrap<br /></code>Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0tag:blogger.com,1999:blog-2200707815281703949.post-12466093614242206752008-04-12T22:42:00.006+02:002008-04-14T11:50:42.252+02:00Scala DSL for CamelI attended <a href="http://www.eu.apachecon.com">ApacheCon Europe</a> this week in Amsterdam. Finally got a chance to meet <a href="http://gnodet.blogspot.com/">Guillaume Nodet</a> after chatting with him for hours on IRC and <a href="http://bsnyderblog.blogspot.com/">Bruce Snyder</a> was there as well, so I guess the the ServiceMix team was duly represented.<br /><br />Personally, I was particularly interested in the talks on JCR, Jackrabbit and Sling. I was planning to build a message archiving and monitoring solution for ServiceMix and the talks have convinced me to go for it.<br /><br />Also took this opportunity to give a 15 minute Fast Feather talk on the new Scala DSL in Camel. The slides are available <a href="http://www.anova.be/node/17">here</a>.Gert Vanthienenhttp://www.blogger.com/profile/16783777760543797722noreply@blogger.com0