You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

ServiceMix can be used as a protocol bridge. The following tutorial will explain how to create a JBI Service Assembly (aka a JBI application) to bridge two different protocols. In this example, we will bridge the HTTP/SOAP with the JMS protocol. We will also put between the two protocols an XSLT transformation.
We will leverage ServiceMix archetypes and maven plugin (see Maven JBI plugin).

Identifying the service units

Our JBI SA (Service Assembly) will be composed of the following SUs (Service Units):

  • an HTTP+SOAP consumer
  • a routing slip to call the XSLT transformer and the JMS provider
  • an XSLT transformer
  • a JMS provider

Creating the project structure

Directory layout

We aim to have the following project structure:

bridge\
  pom.xml
  bridge-http-su\
    ...
  bridge-eip-su\
    ...
  bridge-xslt-su\
    ...
  bridge-jms-su\
    ...
  bridge-sa\
    ...

Main pom

We will use ServiceMix archetypes to create the SUs and SA, so let's write the main pom first:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.servicemix.samples</groupId>
  <artifactId>bridge</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <modules>
    <module>bridge-http-su</module>
    <module>bridge-eip-su</module>
    <module>bridge-xslt-su</module>
    <module>bridge-sa-su</module>
  </modules>
</project>

Creating the archetypes

In the bridge directory, run the following commands:

mvn archetype:create \
        -DarchetypeGroupId=org.apache.servicemix.tooling \
        -DarchetypeArtifactId=servicemix-http-consumer-service-unit \
        -DarchetypeVersion=1.0-incubating-SNAPSHOT \
        -DgroupId=org.apache.servicemix.samples.bridge \
        -DartifactId=bridge-http-su

mvn archetype:create \
        -DarchetypeGroupId=org.apache.servicemix.tooling \
        -DarchetypeArtifactId=servicemix-jms-provider-service-unit \
        -DarchetypeVersion=1.0-incubating-SNAPSHOT \
        -DgroupId=org.apache.servicemix.samples.bridge \
        -DartifactId=bridge-jms-su

mvn archetype:create \
        -DarchetypeGroupId=org.apache.servicemix.tooling \
        -DarchetypeArtifactId=servicemix-service-unit \
        -DarchetypeVersion=1.0-incubating-SNAPSHOT \
        -DgroupId=org.apache.servicemix.samples.bridge \
        -DartifactId=bridge-eip-su

mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-service-unit \
-DarchetypeVersion=1.0-incubating-SNAPSHOT \
-DgroupId=org.apache.servicemix.samples.bridge \
-DartifactId=bridge-xslt-su


mvn archetype:create \
        -DarchetypeGroupId=org.apache.servicemix.tooling \
        -DarchetypeArtifactId=servicemix-service-assembly \
        -DarchetypeVersion=1.0-incubating-SNAPSHOT \
        -DgroupId=org.apache.servicemix.samples.bridge \
        -DartifactId=bridge-sa
  • No labels