Archive
Creating a JBI Component with PEtALS CDK (Part 1)
Here is a series of articles about how to create a JBI Component with the PEtALS Component Development Kit (CDK).
The current one describes how to create the project structure with the PEtALS Maven archetypes, how to use it in Eclipse and how to package it as a JBI component.
Create the project structure
(I assume that Maven is installed and is in the path, if not please refer to the Apache Maven website).
mvn archetype:create
-DarchetypeGroupId=org.ow2.petals
-DarchetypeArtifactId=maven-archetype-petals-jbi-service-engine
-DarchetypeVersion=1.3.0-SNAPSHOT
-DgroupId=com.ebmws.petals
-DartifactId=petals-se-sample
-Dversion=1.0-SNAPSHOT
This will create the standard component structure.
You can check the JBI descriptor in petals-se-sample/src/main/jbi. Note that some fields such as the classpath are automatically filled during the packaging phase from the dependencies specified in your POM descriptor.
Create the Eclipse project
cd petals-se-sample
mvn eclipse:eclipse
In Eclipse, import the project and you will get
Do your business code
Now in the JBIListener class, you can implement the business logic which will be called when a JBI message is received in the activated JBI Endpoind (How to activate endpoint will come in the next article).
For example, just say hello to the world in the JBIListener like this :
Package the component
Simply package it with
mvn install
You will get a ZIP archive in the target directory which is the component you can deploy in PEtALS container
The source of this component are available here http://christophe.hamerling.free.fr/ebm/blog/tuto/cdk/petals-se-sample.zip