This part will introduce you to the development of an ESB Deployment Package using the maven plugin.
We advise you to look at existing ESB Deployment Packages on int-factory in the SonicPartnerCodeshare/Projects location. These projects can offer an initial guidance to start.
You can also create Arche-Types for your developers. However, this will not be handled in this users-guide.
As depicted in the image, the plugin is working with a standard maven layout. The important locations are:
The Maven-Plugin for ESB Deployment Packages takes a couple of files:
The Model.xml file contains all needed information to create a successfull deployment package. All variables are externalized using the @Variable@ pattern. The plugin will recognize these variables and extract them in the Topology tailoring file.
The plugin will also add some items to the Model.xml file:
<xi:include href="mfesbcontainer/@MFContainerName2@"/>
One of the most common configuration tasks is to define the container mapping for an SDM model. Therefore the ContainerProperties.xml file needs to be tailored to the deployment needs.
The location of the file is: src/main/sonicesb/ContainerProperties.xml.
The format of this file is as follows:
<configuration> <containerMap> <esbContainerSettings> ... </esbContainerSettings> <mfContainerSettings> ... </mfContainerSettings> </containerMap> </configuration>
This mapping will defines in which ESB container(s) a service instance will be deployed. By default all service instances will be deployed to the default ESBContainer (name=ESBContainer). If a service/process instance is selected by a dedicated container pattern it is removed from the default container. An instances can be added to multiple dedicated containers.
Note: The name DefaultContainer in the configuration is just the name of the Java class which implements the mapping and has no further meaning.
The ContainerMap element can contain the following sub-elements:
Setting useESBDefaultIncludes to false can be useful when you want to import service instances or processes into the domain but you don't want to create an ESB container for them.
Setting useMFDefaultIncludes to false can be useful when you want to import ESB containers into the domain but you don't want to create an MF container for them.
The DefaultContainerSetting has the following Elements that can be set in order to change the ESB Container Configuration:
An mapping example can be found below. All pattern elements support regular expression patterns.
The esbContainerSettings/DefaultContainerSetting/includes/DefaultIncludePattern supports the following includeProperties:
The mfContainerSettings/DefaultContainerSetting supports the following extra settings:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <containerMap> <esbContainerSettings> <DefaultContainerSetting> <!-- ESB Container name--> <name>ctESBsvn2hudson</name> <busConnection>gfo-jms</busConnection> <routingHttpConnection>gfo-jms</routingHttpConnection> <enablePayloadCapture>true</enablePayloadCapture> <useForLookingGlass>true</useForLookingGlass> <useIntraContainerMessaging>true</useIntraContainerMessaging> <includes> <DefaultIncludePattern> <!-- matched against the service instance info attribute. See snippets --> <pattern>.*</pattern> <includeProperties> <property> <!-- classpath pattern for the ESB Container --> <name>classpathPattern</name> <!-- regex to match nothing, to have no additional jars on the classpath --> <value>#</value> </property> <property> <name>instances</name> <!-- Number of service instances --> <value>5</value> </property> <property> <name>startupPriorityLevel</name> <value>2</value> </property> <property> <name>ConcurrentCalls</name> <value>0</value> </property> </includeProperties> </DefaultIncludePattern> </includes> </DefaultContainerSetting> </esbContainerSettings> <mfContainerSettings> <DefaultContainerSetting> <name>@MFESBContainer@</name> <includes> <DefaultIncludePattern> <pattern>ctESBsvn2hudson</pattern> <includeProperties> <property> <name>Hosts</name> <value>ESBHost,MyMachine</value> </property> <property> <name>AutoStart</name> <value>true</value> </property> </includeProperties> </DefaultIncludePattern> </includes> <backupContainer>@MFESBContainer@BAK</backupContainer> <clone>true</clone> <bootContainer>false</bootContainer> <Segment>OurESBContainers</Segment> <ContainerParameterSet>MyContainerParameterSet</ContainerParameterSet> <LogDirectory>MyLogDirectoryValue</LogDirectory> </DefaultContainerSetting> </mfContainerSettings> </containerMap> </configuration>
By default, queues are assigned to the last Queues element in the SDM Model.xml file. If you want to change this behavior you can create a file called QueueMappings.xml in the src/main/sonicesb directory. The contents of this file should be as follows:
<queueMappings> <defaultMapping> <id>defaultQueuesElement</id> <parameterSet>defaultQueue</parameterSet> <suppressJNDI>true</suppressJNDI> </defaultMapping> <queueMapping> <id>applicationABCQueues</id> <parameterSet>applicationEntryQueue</parameterSet> <suppressJNDI>false</suppressJNDI> <includes> <include>.*entry$</include> </includes> </queueMapping> <queueMapping> <id>applicationABCQueues</id> <includes> <include>(applicationa|applicationb)\..*</include> <include>applicationc\..*</include> </includes> <excludes> <exclude>applicationd.*</exclude> </excludes> </queueMapping> </queueMappings>
Note: The parameter suppressJNDI is valid only for SDM version 7.6.x or below. From version 8.0 the JNDI generation has changed, and this parameter is no longer valid
This will cause the Queues to be assigned to the queue element that matches any include regular expression but none of the optional exclude regular expressions. The first mapping that matches a queue get the queue assigned. If no mappings match the queue, it will be assigned to the queues element mentioned in the defaultMapping setting.
includes are required in the queueMapping element, excludes are optional. Neither may appear in the defaultMapping element. When there is no defaultMapping element, the last Queues element in Model.xml becomes the default. You can set the defaultMapping to a non-existent Queues element to force explicit definitions for all queues in the SDM model. The build will fail when the Queues element for a certain queue does not already exist.
<groupId>your.group.id</groupId> <artifactId>artifactId</artifactId> <version>1.0-SNAPSHOT</version> <name>Short Name</name> <packaging>sdm</packaging> <description>Small description of what this Process is doing</description> <url>http://Servcer/location-to-doc/${project.groupId}/${project.artifactId}/${project.version}</url>
<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> <plugins> <!-- Assemble all dependencies with repository layout --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>3.2</version> <configuration> <reportPlugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.6</version> <!-- <configuration> <dependencyDetailsEnabled>false</dependencyDetailsEnabled> <dependencyLocationsEnabled>false</dependencyLocationsEnabled> </configuration> --> <!-- simpler configuration without reportSets available for usual cases --> <!-- <reports> <report>dependencies</report> <report>scm</report> </reports> --> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jdepend-maven-plugin</artifactId> </plugin> </reportPlugins> </configuration> </plugin> <plugin> <groupId>com.aurea.maven.plugins</groupId> <artifactId>sonicesb-maven-plugin</artifactId> <version>${maven-sonicesb-plugin.version}</version> <extensions>true</extensions> <configuration> <containerMap> <esbContainerSettings> <DefaultContainerSetting> <name>ESBContainer</name> </DefaultContainerSetting> </esbContainerSettings> <mfContainerSettings> <DefaultContainerSetting> <name>@MFESBContainer@</name> </DefaultContainerSetting> </mfContainerSettings> </containerMap> </configuration> </plugin> </plugins> </build>