Академический Документы
Профессиональный Документы
Культура Документы
_____________________________________________________________________________________
Hacke kabouya
_____________________________________________________________________________________
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="CompiledMessageFlow" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="CompiledMessageFlow">
<xsd:annotation>
<xsd:documentation>
A CompiledMessageFlow element defines all the property overrides
for a single compiled msgflow ("CMF") file in the root folder of
the bar archive.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ConfigurableProperty" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConfigurableProperty">
<xsd:annotation>
<xsd:documentation>
A ConfigurableProperty optionally specifies a deploy-time
value for a single configurable property.
Attribute "uri" specifies the broker-schema qualified flow name,
the node name (if needed),and the property name. Uri is required.
Attribute "override" specifies the value to assign to the
property during installation.
Override is optional. If override is not set, the configurable
property value at install defaults to the value in the flow.
If override is set (even to ""), the value of the configurable
property at install is set to the value of override.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute ref="uri" use="required" />
<xsd:attribute ref="override" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:attribute name="uri" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
The following specifies the syntax for uri attribute values in the
Hacke kabouya
_____________________________________________________________________________________
broker.xml ConfigurableProperty elements.
URI
>>--+-------------------+--flowName-- # --+---------------+--propertyName-->>
+--schemaName-- . --+
+--nodeName-- . --+
where:
* "schemaName" is the name of the Broker schema the msgflow was defined in,
or nothing if the msgflow is defined in the unnamed schema.
schemaName is a dot separated list of path segments.
* "flowName"
is the name of the msgflow; i.e. the name of the file without
the .msgflow or .msgnode extension.
* "nodeName"
is the label of the node, if the property is defined on a node.
The nodeName parameter is optional, and does not appear if the
property is defined on a flow.
* propertyName is the name of the property, or the label key if the node is
a primitive node. The descriptor tab of the BAR editor displays
the NL enabled name if the label key matches a NL enabled name,
else it displays the key itself.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="override" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Override is an optional attribute. If the attribute is absent, the
default value set in the msgflow tool will be applied at install time.
If a value is provided for override, then that value will be applied
at install time. If override="", then the value at install time is the
empty string.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:schema>
Hacke kabouya
_____________________________________________________________________________________
.-----------------------.
V
|
>--+----------+----+-------------------+-+-- -o ---------------->
'- -Esql21-'
'- -p --ProjectName-'
.--------------.
V
|
>------FilePath---+--------------------------------------------><
Parameters
-data WorkSpace
(Required) The path of the workspace in which your projects are created.
-b BarName
(Required) The name of the BAR file where the result is stored. The BAR file is replaced if it
already exists and the META-INF/broker.xml file is created within the BAR file.
-cleanBuild
(Optional) Refreshes the projects in the workspace and then invokes a clean build before new
items are added to the BAR file. Use the -cleanBuild parameter to refresh all the projects in the
BAR file and invoke a clean build if amendments have been made to the BAR file resources using
external tools.
-version VersionString
(Optional) Appends the _ (underscore) character and the value of VersionString to the names of the
objects added to the BAR file, before the file extension. In Message Broker V6.0, runtime
versioning was introduced and you should use that mechanism to version your source files and
propagate them to the deployed execution group.
-Esql21
(Optional) Compile ESQL for V2.1 brokers.
-p ProjectName(s)
(Optional) Projects containing files to include in the BAR file. You can specify multiple projects,
which can include a message flow project, a message set project, or a message flow plug-in node
project. If a project that you specify is not part of your workspace, the command links the project
to the workspace so that the files in the project can be included in the BAR file. The command
does not copy the files into your workspace directory. If a project that you specify is part of your
workspace but is closed, the command opens and builds the project so that the files in the project
can be included in the BAR file.
-o FilePath
(Required) The workspace relative path (including the project) of a msgflow or messageSet.mset
file to add to the BAR file. You can add more than one deployable file to this command by using
the following format: -o FilePath1 FilePath2... FilePath'n'.
Using -data with existing workspaces and new workspaces
Hacke kabouya
_____________________________________________________________________________________
The -data parameter for the mqsicreatebar command refers to a workspace directory, and its behavior
varies depending on whether or not the workspace directory already exists.
If the workspace and .metadata directory already exist and already contain the Message Set and Message
Flow projects, then the -p option is not necessary. However, you should always supply the -p option
regardless of whether a workspace directory already exists. If it does exist, issue the -cleanBuild parameter
if any of the files were changed outside the WebSphere Message Broker toolkit. The -cleanBuild option
forces a refresh of all the projects within the given workspace. Then issue a -cleanBuild to synchronize the
projects with the existing .metadata information.
If the workspace directory does not exist, the -p option is mandatory, so that the projects specified by it
can be added to a newly created workspace. The -cleanBuild parameter is not necessary in this case,
because when the projects are added to the new workspace, the -p option forces a clean build on them. Use
the second option when -data references a workspace that does not exist when using Ant to build BAR
files using mqsicreatebar, because the message flow and message set projects are usually extracted from a
repository, and the source files would be out of sync with the workspace that would be used. This would
require the "-cleanBuild" parameter and could give inconsistent results. You can call the mqsicreatebar
command from any Ant task by supplying the correct parameters. Figure 3 below shows a sample Ant task
that will build a given BAR file:
Figure 3. Sample Ant task calling mqsicreatebar command to build a BAR file
<?xml version="1.0"?>
<project name="project" default="run">
<target name="run" description="">
<property name="toolkit.home" value="C:\MessageBroker\602" />
<property name="ant.bars.basedir" value="C:\Dev\messagebroker" />
<property name="workspaces.dir" value="${ant.bars.basedir}\workspace" />
<property name="bar.name" value="${ant.bars.basedir}\postcard.bar" />
<antcall target="mqsicreatebar.buildbar" />
</target>
<!-Target to build the broker archive using mqsicreatebar
-->
<target name="mqsicreatebar.buildbar">
<echo message="Building Broker Archive file: ${bar.name} " />
<exec executable="${toolkit.home}\eclipse\mqsicreatebar.exe" spawn="false">
<arg value="-data" />
<arg value="${workspaces.dir}" />
<arg value="-b" />
<arg value="${bar.name}" />
<arg value="-p" />
<arg value="Postcard" />
<arg value="PostcardFlow" />
<arg value="-o" />
<arg value="Postcard\Postcard\messageSet.mset" />
Hacke kabouya
_____________________________________________________________________________________
<arg value="PostcardFlow\PostcardFlow.msgflow" />
</exec>
<echo message="Completed building Broker Archive file - ${bar.name} " />
</target>
</project>
Parameters
-b BarFile
(Required) The path to the BAR file (absolute, or relative to the executable command), to which
the override values apply.
-p PropertiesFile
(Required) The path to the properties file (absolute, or relative to the executable command) that
contains override values.
The mqsiapplyoverride command can change a specific URI in the broker.xml file, or replace all instances
of a specific override value within the BAR file broker.xml file.
Figure 5 below shows a broker.xml file within a given BAR file before the mqsiapplyoverride command is
applied with the property values from Figure 6. Figure 7 then shows the new broker.xml file within a
given BAR file with the updated values. The two configurable properties that are being changed are:
<ConfigurableProperty uri="PostcardFlow#additionalInstances" />
<ConfigurableProperty override="Q1"
uri="PostcardFlow#MQInput.queueName" />
Figure 5. Sample broker.xml file within a BAR file before applying new override values
<?xml version="1.0" encoding="UTF-8" ?>
<Broker>
<CompiledMessageFlow name="PostcardFlow">
<ConfigurableProperty uri="PostcardFlow#additionalInstances" />
Hacke kabouya
_____________________________________________________________________________________
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
<ConfigurableProperty
</CompiledMessageFlow>
</Broker>
uri="PostcardFlow#commitCount" />
uri="PostcardFlow#commitInterval" />
uri="PostcardFlow#coordinatedTransaction" />
uri="PostcardFlow#MQInput.serializationToken" />
uri="PostcardFlow#MQInput.topicProperty" />
uri="PostcardFlow#Postcard.validateMaster" />
uri="PostcardFlow#MQOutput.queueManagerName" />
uri="PostcardFlow#MQOutput.replyToQMgr" />
uri="PostcardFlow#Postcard.dataSource" />
uri="PostcardFlow#MQOutput.replyToQ" />
uri="PostcardFlow#MQInput.validateMaster" />
uri="PostcardFlow#MQOutput.validateMaster" />
override="Q1" uri="PostcardFlow#MQInput.queueName" />
uri="PostcardFlow#MQOutput.queueName" />
Figure 7. Sample broker.xml file within a BAR file after applying new override values
<?xml version="1.0" encoding="UTF-8" ?>
<Broker>
<CompiledMessageFlow name="PostcardFlow">
<ConfigurableProperty override="2" uri="PostcardFlow#additionalInstances" />
<ConfigurableProperty uri="PostcardFlow#commitCount" />
<ConfigurableProperty uri="PostcardFlow#commitInterval" />
<ConfigurableProperty uri="PostcardFlow#coordinatedTransaction" />
<ConfigurableProperty uri="PostcardFlow#MQInput.serializationToken" />
<ConfigurableProperty uri="PostcardFlow#MQInput.topicProperty" />
<ConfigurableProperty uri="PostcardFlow#Postcard.validateMaster" />
<ConfigurableProperty uri="PostcardFlow#MQOutput.queueManagerName" />
<ConfigurableProperty uri="PostcardFlow#MQOutput.replyToQMgr" />
<ConfigurableProperty uri="PostcardFlow#Postcard.dataSource" />
<ConfigurableProperty uri="PostcardFlow#MQOutput.replyToQ" />
<ConfigurableProperty uri="PostcardFlow#MQInput.validateMaster" />
<ConfigurableProperty uri="PostcardFlow#MQOutput.validateMaster" />
<ConfigurableProperty override="TEST_QUEUE"
uri="PostcardFlow#MQInput.queueName" />
<ConfigurableProperty uri="PostcardFlow#MQOutput.queueName" />
Hacke kabouya
_____________________________________________________________________________________
</CompiledMessageFlow>
</Broker>
You can call the mqsiapplybaroverride command from any Ant task by supplying the correct parameters.
Figure 8 below shows a sample Ant task that will change the override values within a given BAR file:
Figure 8. Sample Ant task calling mqsiapplybaroverride command to modify a BAR file deployment
descriptor
<?xml version="1.0"?>
<project name="project" default="run">
<target name="run" description="">
<property name="toolkit.home" value="C:\MessageBroker\602" />
<property name="ant.bars.basedir" value="C:\Dev\messagebroker" />
<property name="bar.name" value="${ant.bars.basedir}\postcard.bar" />
<property name="bar.properties.name"
value="${ant.bars.basedir}\brokerxml.properties" />
<antcall target="mqsiapplybaroverride.modifybar" />
</target>
<!-Target to build the broker archive using mqsiapplybaroverride
-->
<target name="mqsiapplybaroverride.modifybar">
<echo message="Applying overrides in Broker Archive file - ${bar.name} " />
<echo
message="${toolkit.home}\eclipse\mqsiapplybaroverride.exe
-b ${bar.name} -p ${bar.properties.name}" />
<exec executable="${toolkit.home}\eclipse\mqsiapplybaroverride.exe" spawn="false">
<arg value="-b" />
<arg value="${bar.name}" />
<arg value="-p" />
<arg value="${bar.properties.name}" />
</exec>
<echo message="Completed apply overrides in Broker Archive file - ${bar.name}" />
</target>
</project>
Conclusion
This article has shown you how to use the Ant scripting language to automate the scripting process of
building BAR files using WebSphere Message Broker command-line tools, to reduce manual intervention
and avoid common mistakes when building BAR files. Using Ant scripts to build BAR files provides a
consistent and reliable way to modify deployment descriptors within them.
Hacke kabouya
_____________________________________________________________________________________
Based on the above IBM article, and to conclude, I have created a full ANT project script that include the
3 phases:
- Build the bar file
- Checkout and build the bar file
- Checkout, build the bar file and deploy
Recommendation: I dont recommend the use of any automation to build and deploy the bar files since it
requires an add on configuration locally and in the long term it will be very hard to maintain and support.
It is easier and safer to use the toolkit to do a clean job.
The ANT project below could be used as is. Some properties need to be modified according to the local
WMB installation.
Build the project bar file
<project name="project" default="run">
<!-<target name="run" description="">
-->
<property name="toolkit.home" value="D:\IBM\WMBT700"/>
<property name="projekt" value="B2B_Replies_DE"/>
<property name="workspaces.dir" value="D:\workspace70N"/>
<property name="barfile" value="${workspaces.dir}\${projekt}\$
{projekt}.bar"/>
<!-- Target to build the broker archive using mqsicreatebar -->
<target name="cleanBuild">
Hacke kabouya
_____________________________________________________________________________________
<echo message="Building Broker Archive file: ${barfile} "/>
<exec executable="${toolkit.home}\mqsicreatebar.exe" vmlauncher="false"
failonerror="true" spawn="false">
<arg value="-data"/>
<arg value="${workspaces.dir}"/>
<arg value="-b"/>
<arg value="${barfile}"/>
<arg value="-p"/>
<arg value="${projekt}"/>
<arg value="-o"/>
<arg value="${projekt}\orderListReply_DGM.msgflow"/>
</exec>
<echo message="Completed building Broker Archive file - ${barfile} "/>
</target>
<target name="run" >
<antcall target="cleanBuild"/>
<!-<antcall target="deploy" depends="run">
-->
</target>
</project>
-->
Hacke kabouya
10
_____________________________________________________________________________________
<echo message="Checking-out"/>
<exec executable="svn" vmlauncher="false" spawn="false" logError="true"
failonerror="true">
<arg value="checkout"/>
<arg value="${url.mainline}/${projekt}/trunk/${projekt}"/>
</exec>
<echo message="Checked-out"/>
</target>
<property name="url.mainline" value="svn://eual0002.biz.electrolux.com"/>
<!--
The target clean deletes the project contents to be recreated during the building phase.
-->
<target name="clean">
<echo message="Cleaning"/>
<delete dir="$${workspaces.dir}\${projekt}"/>
<echo message="Cleaned"/>
</target>
<!-- Target to build the broker archive using mqsicreatebar -->
<target name="cleanBuild">
<echo message="Building Broker Archive file: ${barfile} "/>
<exec executable="${toolkit.home}\mqsicreatebar.exe" vmlauncher="false"
failonerror="true" spawn="false">
<arg value="-data"/>
<arg value="${workspaces.dir}"/>
<arg value="-b"/>
<arg value="${barfile}"/>
<arg value="-p"/>
<arg value="${projekt}"/>
<arg value="-o"/>
<arg value="${projekt}\orderListReply_DGM.msgflow"/>
</exec>
<echo message="Completed building Broker Archive file - ${barfile} "/>
</target>
<target name="run" >
<antcall target="cleanBuild" depends="checkout">
<antcall target="deploy" depends="run">
-->
</target>
</project>
Checkout the project, build the bar file and deploy it.
Lets add the deploy target to be performed after the bar file creation.
This task requires a lot of customisation that need to be done on every local installation where deploy will
be performed.
Hacke kabouya
11
_____________________________________________________________________________________
The deploy commands requires the Websphere message broker installation locally or Installing the
Configuration Manager Proxy (CMP) applications and run a set of Java applications in environments that
do not have the broker component installed.
mqsicreateexecutiongroup
mqsideleteexecutiongroup
mqsistartmsgflow
mqsistopmsgflow
mqsideploy
WebSphere Message Broker for Windows provides two variants of the mqsideploy command,
mqsideploy.bat and mqsideploy.exe.
mqsideploy.bat can be used only in environments that do not have the broker component installed.
To install CMP applications in an environment that does not have the broker component installed, perform
the following steps:
Ensure that a compatible Java Runtime Environment (JRE) is installed
Copy the following set of files from WMB installation to the target computer:
ConfigManagerProxy.jar from the classes directory.
The WebSphere MQ Classes for Java.
On Windows, these classes are located in com.ibm.mq.jar.
On other platforms, these are located in the component's installation image.
If you want to run any of the available broker utilities on the target computer, perform the following steps:
Copy ConfigUtil.jar from the classes directory.
Copy the required utility bat files, or shell scripts, from the bin directory. Copy one or more of the
following bat files:
mqsicreateexecutiongroup.bat
mqsideleteexecutiongroup.bat
mqsistartmsgflow.bat
mqsistopmsgflow.bat
mqsideploy.bat
If you want to display broker (BIP) messages in English environments other than US English, copy all
BIPv600*.properties files from the messages directory.
On the target computer, update the CLASSPATH environment variable to include the following files:
The CMP classes, ConfigManagerProxy.jar.
The WebSphere MQ Classes for Java, com.ibm.mq.jar, and any additional JARs required.
Any other required JARs and directories.
Hacke kabouya
12
_____________________________________________________________________________________
For example, if you require any of the available command utilities on the target computer, include
ConfigUtil.jar; if you require the broker (BIP) messages to be displayed in environments other than US
English, include a directory that contains BIPv600*.properties.
Ensure that the user ID that the target computer uses has the following authorities:
Authority to manipulate broker domain objects.
Once the CMP has been installed and configured locally, the final ANT script is ready with all different
tasks.
<project name="project" default="run">
<property name="toolkit.home" value="D:\IBM\WMBT700"/>
<property name="projekt" value="B2B_Replies_DE"/>
<property name="workspaces.dir" value="D:\workspace70N"/>
<property name="barfile"
value="${workspaces.dir}\${projekt}\${projekt}.bar"/>
<property name=" mqsideploy.home" value=" D:\WMB" />
<property name="ipaddress" value="euus7406.biz.electrolux.com" />
<property name="port" value="1414" />
<property name="queuemgr" value="EUUS7406" />
<property name="broker" value=" EUUS7406" />
<property name="exegroup" value="EG01" />
<!--
-->
The target clean deletes the project contents to be recreated during the build fase.
Hacke kabouya
13
_____________________________________________________________________________________
-->
<target name="clean">
<echo message="Cleaning"/>
<delete dir="$${workspaces.dir}\${projekt}"/>
<echo message="Cleaned"/>
</target>
<!-- Target to build the broker archive using mqsicreatebar -->
<target name="cleanBuild">
<echo message="Building Broker Archive file: ${barfile} "/>
<exec executable="${toolkit.home}\mqsicreatebar.exe" vmlauncher="false"
failonerror="true" spawn="false">
<arg value="-data"/>
<arg value="${workspaces.dir}"/>
<arg value="-b"/>
<arg value="${barfile}"/>
<arg value="-p"/>
<arg value="${projekt}"/>
<arg value="-o"/>
<arg value="${projekt}\orderListReply_DGM.msgflow"/>
</exec>
<echo message="Completed building Broker Archive file - ${barfile} "/>
</target>
<target name="deployBar">
<echo message="${mqsideploy.home}\bin\mqsideploy.bat"></echo>
<exec executable="${mqsideploy.home}\bin\mymqsideploy.bat" spawn="false"
logError="true" vmlauncher="false" failonerror="true" append="true">
<arg value="-i" />
<arg value="${ipaddress}" />
<arg value="-p" />
<arg value="${port}" />
<arg value="-q" />
<arg value="${queuemgr}" />
<arg value="-b" />
<arg value="${broker}" />
<arg value="-e" />
<arg value="${exegroup}" />
<arg value="-bar" />
<arg path="${barfile}" />
</exec>
<echo message="Deploying Broker Archive file - ${bar.name} " />
</target>
<target name="run" >
<antcall target="cleanBuild" depends="checkout">
<antcall target="deployBar" depends="run">
-->
</target>
</project>
Hacke kabouya
14