Saturday, October 5, 2013

Maven Archetypes for WSO2 ESB Customizable Artifacts

WSO2 ESB provides most of the features you need to build your integration scenarios.
But there can be situations where built-in functionality is not sufficient to implement your requirement.
To cope with those situations WSO2 ESB has given you the enough freedom to simply extend the functionality by implementing custom artifacts.

Following are some of the main extension points where you can extend the functionality.

1. Class Mediators
2. Custom Tasks
3. Message Builders
4. Message Formatters

I am not going to discuss much on these artifacts here. Intention of this post is to provide you an easy way of creating these artifact projects.
I have created maven-architypes for above four artifacts.


You can checkout them from here.

Example usage

Let's create a project structure for a Class mediator.

1. Go to maven-archetype-classmediator directory.
Execute the command
mvn install

This will install classmediator maven archetype to your maven repository.

2. Go to the location where you want to create a new project structure.
Execute the command
mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=org.wso2.carbon  -DarchetypeArtifactId=maven-archetype-classmediator

3. You will be prompted to enter following details.
groupId
artifactId
version
mediator_name

This will create the project structure for your class mediator.
Now you can edit the Mediator java class and write your logic in the mediate() method.

4. After writing the code, you can simply execute the command
mvn clean install
to compile and create the jar file of the class mediator.

No comments:

Post a Comment