|
This note is for BusinesWorks 5.8, Tibco RuntimeAgent 5.6, Ant 1.8, and Groovy 1.8.
Sometimes custom properties need to be added to TRA files after a deployment of a Tibco BusinessWorks process. For example when BW processes are monitored with external applications such as Progress Actional.
It is possible to manually edit the TRA files after each deployment. This is time consuming an error prone. Therefore it is better to use ant for a scripted deployment with AppManage. Don't start the BW engine directly after the deployment but first call the ant target to modify the tra file. Then script with ant to call AppManage to start the BW engines.
Of course the ant code below can be executed by calling ant from the command line. But it is much easier to set up a build system such as Jenkins and then call the script from its web front-end with just a single click.
The ant target modifying the tra files is shown below:
<target name="modifyTra">
<groovy>
<![CDATA[
def bwHost = properties.get("bw.host");
def sshUser = properties.get("sshUser")
def sshPassword=properties.get("ssh.password");
def tibcoAdminDomain = properties.get("tibco.admin.domain")
def tibcoInstallationDir = properties.get("tibco.server.installationDir")
def tibcoDomainDir = tibcoInstallationDir +"/tra/domain/" +properties.get("tibco.admin.domain")
def packageName = properties.get("source.packagename")
def traFileName = properties.get("tibco.traFile") +".tra"
def traDir = tibcoDomainDir +"/application/" +packageName
ant.scp(
trust:true,
file: sshUser +":" +sshPassword +"@" +bwHost +":" +traDir +"/" +traFileName,
todir: "."
){}
ant.ant(antfile: properties.get('environment') +"." +traFile +".xml", target:"modifyTraFile"){
property(name:'traFileName', value:traFileName)
}
ant.copy(file: traFileName, tofile:traFileName +"_orig" +properties.get("BUILD_ID")){}
ant.scp(
trust:true,
todir: sshUser +":" +sshPassword +"@" +bwHost +":" +traDir +"/" +packageName,
file: traFileName
){}
]]>
</groovy>
</target>
This target calls an external ant build file, e.g. PROD.myTraFile.tra:
<project name="modifyTraFile">
<description>Modify the tra file ${traFileName}
</description>
<target name="modifyTraFile">
<propertyfile file="${traFileName}">
<entry key="bw.plugin.http.server.maxProcessors" value="10"/>
<entry key="bw.plugin.http.client.ResponseThreadPool" value="10"/>
</propertyfile>
</target>
</project>
In the second build file the ant task modifyTraFile uses the fact that Tibco TRA files are in fact Ant property files. That means that adding and modifying properties within TRA files is straightforward with the Ant propertyfile task.
Of course the ant scripts above can be executed by calling ant from the command line. But it is much easier to set up a build system such as Jenkins and then call the script from its web front-end with just a single click.
|