Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For this example, let's suppose that we're creating a consumer SU. A consumer SU contains a configuration that tells the servicemix-http component to expose an endpoint via HTTP for some service that is already deployed to the JBI container. Below is the command to create the consumer SU Maven project for the servicemix-http component:

Code Blocknoformat
$ mvn archetype:create \
   -DarchetypeGroupId=org.apache.servicemix.tooling \
   -DarchetypeArtifactId=servicemix-http-consumer-service-unit \
   -DarchetypeVersion=3.1-incubating \
   -DgroupId=com.mycompany \
   -DartifactId=my-consumer-su \
   -DremoteRepositories=http://people.apache.org/repo/m2-incubating-repository

The command above utilizes the servicemix-http-consumer-service-unit Maven archetype to create a Maven project named my-consumer-su. This command creates a directory named my-consumer-su that contains a Maven project skeleton meaning all the necessary files are in place, you simply need to enter the correct values for the configuration. Below is the directory structure created by this archetype:

Code Blocknoformat
./pom.xml
./src
./src/main
./src/main/resources
./src/main/resources/xbean.xml

...

Once the SU is fully configured, it must be packaged. This is easy to do because the project skeleton provides all the necessary project configuration and use of the Maven JBI plugin for you via the pom.xml file. Simply run the following command while sitting in the my-consumer-su directory:

Code Blocknoformat
$ mvn install 

You will need to have Maven 2.0.4 or higher installed in order to run this command. This packages up the SU and places the build artifact in the target directory.

...

The only requirement of a JBI SU is that it contain a JBI deployment descriptor located in META-INF/jbi.xml. As mentioned above, the Maven archetypes for SUs creates a pom.xml file that includes configuration and use of the Maven JBI plugin. This is a plugin that automatically generates the META-INF/jbi.xml file based on other information in the pom.xml file. Below is the hierarchy of the contents of the SU archive that is created when running the Maven install goal as noted above:

Code Blocknoformat
$ jar tvf ./target/my-consumer-su-1.0-SNAPSHOT.jar 
     0 Wed Mar 28 20:19:52 MDT 2007 META-INF/
   126 Wed Mar 28 20:19:50 MDT 2007 META-INF/MANIFEST.MF
   292 Wed Mar 28 20:19:50 MDT 2007 META-INF/jbi.xml
  1281 Wed Mar 28 20:19:40 MDT 2007 xbean.xml
     0 Wed Mar 28 20:19:52 MDT 2007 META-INF/maven/
     0 Wed Mar 28 20:19:52 MDT 2007 META-INF/maven/com.mycompany/
     0 Wed Mar 28 20:19:52 MDT 2007 META-INF/maven/com.mycompany/my-consumer-su/
  2613 Wed Mar 28 17:30:46 MDT 2007 META-INF/maven/com.mycompany/my-consumer-su/pom.xml
   119 Wed Mar 28 20:19:50 MDT 2007 META-INF/maven/com.mycompany/my-consumer-su/pom.properties

Notice that this SU archive contains a META-INF/jbi.xml file. This was created by the Maven JBI plugin. Below is the pom.xml file for the project above:

Code Blocknoformat
$ cat ./target/my-consumer-su-1.0-SNAPSHOT-installer/META-INF/jbi.xml 
<?xml version="1.0" encoding="UTF-8"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
  <services binding-component="false" xmlns:replaceMe="http://servicemix.apache.org/replaceMe">
    <consumes service-name="replaceMe:withYourService" endpoint-name="soap"/>
  </services>
</jbi>

...