Each service unit in the service assembly needs to be its own project. These projects are placed at the same level as the service assembly project. The contents of a service units project depends on the component at which the service unit is targeted. At a minimum, a service unit project will contain a POM and an XML configuration file.
FUSE ESB provides Maven artifacts for a number of service unit types. You can use them to seed a project with the smx-arch command. As shown in Example B.3, the smx-arch command takes three arguments. The groupId value and the artifactId values correspond to the project's group ID and artifact ID.
Example B.3. Maven Archetype Command for Service Units
smx-arch su suArchetypeName ["-DgroupId=my.group.id"] ["-DartifactId=my.artifact.id"]
![]() | Important |
|---|---|
The double quotes(") are required when using the |
The suArchetypeName specifies the type of service unit to seed. Table B.1 lists the possible values and describes what type of project will be seeded.
Table B.1. Service Unit Archetypes
| Name | Description |
|---|---|
| http-consumer | Creates a consumer endpoint project targeted at the HTTP binding component. |
| http-provider | Creates a provider endpoint project targeted at the HTTP binding component. |
| jms-consumer | Creates a consumer endpoint project targeted at the JMS binding component. See Using the JMS Binding Component. |
| jms-provider | Creates a provider endpoint project targeted at the JMS binding component. See Using the JMS Binding Component. |
| ftp-poller | Creates a polling (consumer) endpoint project targeted at the FTP binding component. |
| ftp-sender | Creates a sender (provider) endpoint project targeted at the FTP binding component. |
| jsr181-annotated | Creates a project for developing an annotated Java service to be run by the JSR181 service engine. [a] |
| jsr181-wsdl-first | Creates a project for developing a WSDL generated Java service to be run by the JSR181 service engine.[a] |
| saxon-xquery | Create a project for executing xquery statements using the Saxon service engine. |
| saxon-xslt | Create a project for executing XSLT scripts using the Saxon service engine. |
| eip | Creates a project for using the EIP service engine. [b] |
| lwcontainer | Create a project for deploying functionality into the lightweight container. [c] |
| bean | Creates a project for deploying a POJO to be executed by the bean service engine. |
| ode | Create a project for deploying a BPEL process into the ODE service engine. |
[a] The JSR181 has been deprecated. The FUSE Services Framework service engine has superseded it. [b] The EIP service engine has been deprecated. The FUSE Mediation Router service engine has superseded it. [c] The lightweight container has been deprecated. | |
The contents of your service unit project change from service unit to service unit. Different components require different configuration. Some components, such as the FUSE Services Framework service engine, require that you include Java classes.
At a minimum, a service unit project will contain two things:
a POM file that configures the JBI plug-in to create a service unit
an XML configuration file stored in src/main/resources
For many of the components the XML configuration file is called xbean.xml. The FUSE Mediation Router component uses a file called camel-context.xml.
You configure the Maven plug-in to package the results of the project build as a service unit by changing the value of the project's packaging element to jbi-service-unit as shown in Example B.4.
Example B.4. Configuring the Maven Plug-in to Build a Service Unit
<project ...>
<modelVersion>4.0.0</modelVersion>
...
<groupId>com.widgets.demo.cxf-wsdl-first</groupId>
<artifactId>cxfse-wsdl-first-su</artifactId>
<name>CXF WSDL Fisrt Demo :: SE Service Unit</name>
<packaging>jbi-service-unit</packaging>
...
</project>In order to properly fill in the metadata required for packaging a service unit, the Maven plug-in needs to be told what component, or components, the service unit is targeting. This can be done in one of two ways: listing the targeted components as dependencies or adding componentName properties.
The recommended way to specify the targeted component is by specifying the component as a dependency using the standard Maven dependencies element. You add dependency child element for each component the service unit is targeting. Example B.5 shows configuration for a service unit targeting the FUSE Services Framework binding component.
Example B.5. Specifying the Target Components for a Service Unit
...
<dependencies>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-cxf-bc</artifactId>
<version>3.3.1.0-fuse</version>[2]
</dependency>
</dependencies>
...The advantage of using the Maven dependency mechanism is that it allows Maven to check if the targeted component is deployed in the container. If the component is not deployed, Maven downloads and deploys the targeted components before deploying the service unit into the container.
If your service unit targets two components or the components you are targeting are not available as Maven artifacts, you can specify the targeted components using the componentName element. This element is added to the standard Maven properties block and specifies the name of a targeted component. Example B.6 shows how to use the componentName element to specify the target component.
Example B.6. Specifying the Target Components for a Service Unit
... <properties> <componentName>servicemix-bean</componentName> </properties> ...
When you use the componentName element Maven does not check to see if the component is installed. Maven also cannot download the required component.
Example B.7 shows the POM file for a project building a service unit targeted to the FUSE Services Framework binding component.
Example B.7. POM for a Service Unit Project
<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>
<parent>
<groupId>com.widgets.demo</groupId>
<artifactId>cxf-wsdl-first</artifactId>
<version>1.0</version>
</parent>
<groupId>com.widgets.demo.cxf-wsdl-first</groupId>
<artifactId>cxfse-wsdl-first-su</artifactId>
<name>CXF WSDL Fisrt Demo :: SE Service Unit</name>
<packaging>jbi-service-unit</packaging>
<dependencies>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-cxf-bc</artifactId>
<version>3.3.1.0-fuse</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>The POM in Example B.7 does the following:
Specifies that it is a part of the top-level project described in Example B.2. | |
Specifies that this project builds a service unit. | |
Specifies that the service unit targets the FUSE Services Framework binding component. | |
Specifies that the FUSE ESB Maven plug-in is to be used. |