Archive for the ‘osgi’ Category


Bootstrap Projects for Getting Started with ServiceMix 4

Over the Christmas break I cleaned up and published a set of Maven projects for getting started with ServiceMix 4.X into GitHub. I found myself reusing the same code for a number of activities, and figured it may be of broader use to others. You can find it under jkorab/smx-bootstraps.

smx-bootstraps contains within it a set of OSGI Blueprints (DI, based on the ideas behind Spring) bundles that exercise some of the core things that you will want to do with ServiceMix:

  • defining services in bundles that can be reused in other bundles
  • use Camel for writing integration code
  • use ActiveMQ for sending persistent messages between bundles, regardless of whether they are in the same container or in others
  • request-response over messaging
  • externalising your environment configuration
  • group bundles into features

The README document at the project root explains how to get started with ServiceMix, deploy bundles, change code and play with config.

Why would you want to use them?

ServiceMix went through a massive generational change between versions 3.X and 4.X, moving from JBI to an OSGi based model. While development work on it is proceeding at a huge rate, the documentation hasn’t kept up – although it is being brought up to date in the background. smx-bootstraps contains small artifacts that are hopefully easy to understand and play with, along with instructions on how to use them in the container.

The project may also be use of use as a starting starting point to further development. A fairly clean project layout exists that you can use as a reference point, which acts as a supplement to the Maven archetypes that are publicly available, such as:

  • org.apache.camel.archetypes:camel-archetype-blueprint for generating Blueprint bundles to run Camel routes; similar to smx-pinger and smx-ponger bundles in smx-bootstraps
  • org.apache.karaf.archetypes:karaf-blueprint-archetype for generating simple Blueprint bundles; such as the smx-ponger-service bundle

I have found these bundles to be a really handy way of exercising ServiceMix features, and working with various configurations. Not having to code up something new each time is a huge time saver. Hopefully you should find this as well.

I expect to expand this little project as time goes on and I find myself recreating other use cases, such as exposing web services – next on my “todo list”. Please drop me a line at “jakub dot korab at gmail” if you find this useful or have any ideas that would fit in well. Of course being GitHub, feel free to fork it or contribute back changes.

Coincidence?

Jason Sankey just posted a list of OSGi tutorials: http://www.alittlemadness.com/?p=80

You have to love RSS…

OSGi vs. JSR-277

I checked out the OSGi presentation from the Parleys site http://www.bejug.org/confluenceBeJUG/display/PARLEYS/Spring+OSGi. Wow. I haven’t really spent any time thinking about this stuff in the past, but it seems that yet again the JSR process is trying to formalize something that doesn’t need it. OSGi seems to be a much lighter, more powerful model whereby you can switch bundles, the JSR-277 module equivalents, at runtime via an OSGi console or JMX. Check out http://www.osgi.org and http://en.wikipedia.org/wiki/OSGi for good synopses of the technology and what it can offer.

The huge advantage here is that the technology is stable, mature and available to use right now (there are a number of open-source implementations) rather than needing to wait for something that won’t be around until Java 7. All that and no new language structures.

There’s an interesting post by Peter Kriens from OSGi about how JSR-277 stacks up at
http://www.osgi.org/blog/2006/10/jsr-277-review.html

"The ambition level of JSR 277 is significantly lower than where the OSGi specifications are today, even way lower than we set out in 1998. In a way, for me the JSR 277 proposal feels rather toyish. "

It’s time to kick the tires on this one, and see where it might be useful.