Thursday, August 29, 2013

Creating and Deploying OSGi bundle on Fuse ESB with Baby Steps

In this post, we’ll develop a Hello World OSGi Bundle. We will use Felix as OSGi container. I develop this without interacting with Maven.

To create OSGI Bundle we required Eclipse IDE, I used Eclipse 3.7.1

  1. Select File|New|Plug-in Project

  2. In Target Platform we will select “an OSGi framework” with standard option

  3. Click Next>. Your screen will be like below

  1. Click Next>. You will find templates screen, Select  Hello OSGi Bundle

  2. Click Next>. And here you will fine screen of OSGi Bundle Wizard, on this screen you can set messages which will be display on start and stop of Bundle

  3. Click Finish>. Now we can see an Activator Class in Eclipse Project with start and stop methods, You can change source code as per your requirements.
  4. To export this project as OSGi Bundle jar do following

    Select "File", "Export ...", "Plug-in Development", and select "Deployable Plug-ins and fragments":

  5.  Click Next>. We will point to the directory and Eclipse will create Jar and place it.

  6. Click Finish>.

  7. Start Fuse ESB by running fuse.bat

  8.  Now to deploy it on Fuse we will just paste this jar file in deploy folder

    FuseESB Home\deploy

  9. As soon as we paste file it will automatically get install, you will see Hello World on console

  10. We can check installed OSGi Bundles with osgi:list, it will give bundle id and status

  11. We can start and stop bundle for like below

No comments: