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

Une réflexion sur “Creating a JBI Component with PEtALS CDK (Part 1)

  1. Hi,
    Can you check this tutorial? I follow the steps above but it’s not ok. There are an error when i deploy with PEtALS. But when i download the source and compile with mvn install, the example works.

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s