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

Compare with Current View Page History

« Previous Version 3 Next »

When you wish to deploy a component you can use a Service Unit to provide instance artifacts. In JBI terms this means that a Service Unit can be defined to be provided to a component which will then be passed the contents of the SU. The JBI is purposefully vague on the contents of an SU (other than the jbi.xml) since how you design your components to operate with *Service Unit*s is up to you.

The Maven tooling provides some basic steps to allow you to build the Service Unit*s, which are simply zip files containing the resources you wish to pass to the component. First you must change you pom.xml to package as a *jbi-service-unit.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.servicemix</groupId>
  <artifactId>MyHttpServiceUnit</artifactId>
  <packaging>jbi-service-unit</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>A service unit</name>
  ...
</project>

A Service Unit is assigned to a component and there are couple of ways you can do this using the tooling, the best way to do this is to actually add the component as a dependency, as shown below for the ServiceMix HTTP component:

<dependencies>
    <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-http</artifactId>
       <version>3.0-incubating-SNAPSHOT</version>
    </dependency>
</dependencies>

This is the preferred way, since the tooling can later do some intelligent dependency calculations and actually find and install the components for you before installing the service assembly containing this service unit. However, if you are going to use a component that isn't available as a Maven dependency (is there such as thing I wonder?), then you can use the project properties to define the component name.

<properties>
     <componentName>servicemix-http</componentName>
</properties>

Once you have configured these steps you can run mvn install and you should find that both a jar and zip version of the service unit are created, this is to allow you to reference the SU as a dependency on the Service Assembly.

Maven Log - Missing

Remember that a Service Unit is pretty useless outside a Service Assembly

  • No labels