Over the Christmas break I cleaned up and published a set of Maven projects for getting started with ServiceMix 4.4.1+ 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 FuseByExample/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
- Update 20/02/2012: RESTful web services!!!
- 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 tosmx-pinger
andsmx-ponger
bundles insmx-bootstraps
-
org.apache.karaf.archetypes:karaf-blueprint-archetype
for generating simple Blueprint bundles; such as thesmx-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.
Comments
2 responses to “Bootstrap Projects for Getting Started with ServiceMix 4”
[…] Bootstrap Projects for Getting Started with ServiceMix 4 […]
Hi, I found it useful, I am looking for a tutorial for developer with plain java background, which explain OSGi and hello world example of bundle its deployment and testing so he could get flavour of this. it would be easy to read detail after creating Hello World.
Usually they ask why OSGI bundle?
Regrads