Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Include Page
apache-felix-ipojo-header
apache-felix-ipojo-header

HTML

<div class="content">

Developing Camel mediators with iPOJO

The Camel OSGi tutorial provides a very simple and neat overview of Camel. This article mentions the usage of iPOJO to implement the mediator. This document provides this implementation.

Step 1 : Initial project setup

Instead of using the 'spring-osgi-bundle-archetype' maven archetype, we will use the iPOJO one to create the iPOJO bundle.
To create the simple iPOJO service project, execute the following command in your Unix/Dos console.

Code Block
nonexmlnone
xml
mvn archetype:create -DarchetypeGroupId=org.apache.felix -DarchetypeArtifactId=maven-ipojo-plugin -DarchetypeVersion=1.0.0 -DgroupId=demo -DartifactId=demo.service-ipojo-bundle -Dversion=0.1

...

The next step concerns the creation of the iPOJO configuration file who will allow the registration of the TranformService as an OSGi service.
Create or edit the file metadata.xml in the folder src/main/resources/

Code Block
javaxmljava
xml
titlemetadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<ipojo>
	<component classname="demo.service.TransformServiceImpl" name="my-ipojo-transformer">
   		<provides/>
	</component>
	<instance component="my-ipojo-transformer"/>
</ipojo>

...

We will see how to execute the Canel route on ServiceMix Kernel.
As mentioned in the documentation, Apache ServiceMix Kernel is a small OSGi based runtime which provides a lightweight container onto which various components and applications can be deployed. Moreover, the server provides administration, security, logging and provisioning features that will help you during the deployment and administration steps.
If this is not yet done, download ServiceMix Kernel 1.0.0 server and install it. Launch the server by executing the command in the bin folder:

Code Block
xml
xml
/Users/clement/apache-servicemix-kernel-1.0.0/bin>servicemix

...

  • In case of trouble, use the command: osgi list to see if all the deployed bundles are installed correctly and have their status equals to active
  • To see the log of ServiceMix, use the command: log d

    Include Page
    apache-felix-ipojo-footer
    apache-felix-ipojo-footer