miércoles, 21 de octubre de 2015

TIBCO BusinessWorks. Global Variables and Property Files

3.1    Global Variables

3.1.1    Description

Global variables provide a simple tool to set defaults values for use throughout the BW project. These variables are defined in the "Global Variables" tab in the TIBCO Designer project view.


When you want to use a global value at runtime as a resource must use enclosed with "%%" (without quotation marks) on both sides.


When you create a global variable, you can specify the following attributes:

• Name: Provides a name for the variable.

• Value: Provides a default value of the variable.

• Deployment: It makes visible the variable from the TIBCO Administrator.

• Service: Indicates that the variable should be included when the "Include all service level Global variables" is checked when the file is created ".ear". This option is used for file TIBCO adapters.

• Type: Select the type of variable, String, Integer, Boolean or password.

• Restriction: Gives String/Integer chains and an allowed range.

• Description: Provides a description of the variable.
The contents of global variables can be modified before deploying the application from the TIBCO Administrator.



You can also specify the values of global variables in an application running in a process engine from the command line. For this you use the following parameter in the BW engine start:

-tibco.clientVar.<variablePathAndName> <valor>

•  variablePathAndName: the variable name (including the path to the variable if placed in a folder or subfolder).
• value: is the value you want to set to the variable.
For example, if you have a global variable name item1 in a folder named myGroup and want to set its value to 500, add the following line as parameter in the BW engine start, and the value will be charged on the engine start process:

-tibco.clientVar.myGroup/item1 500


3.1.2   Use cases

2 uses are contemplated in this section:

• Resource Configuration (HTTP connections, JMS connections, etc.)

• Input values for BW tasks.
Global variables are read-only values that are initialized at the start of BW engine. The values of global variables can change or not change in different environments where the application through TIBCO Administrator is deployed. You can change the Global Variables' value through a parameter in the engine starting from BW or file properties

Global variables are used to reference values:

Resource Settings. Eg: ftp connections, configuration of URL in SOAP tasks for invoking services, etc.

Input Bindings. Input fields on the tasks that form a BW process.


Global variables facilitate code maintenance of our application, but the ultimate goal is to facilitate configuration changes and changes in the application environment. Through global variables a configuration change or a change of environment does not require a modification of the code, application packaging and deployment. You only need to change the value of global variables and stop and restart the engine of BW.

Global variables are often used in the following situations:

Set the environment settings
Tuning or Performance Settings
Setting resources or services
Setting constant references to external systems

3.1.3   Changing global variables

Global variables defined in a project can be modified in the following ways:

1. Using TIBCO Business Works Designer at design time.

2. Using TIBCO Administrator at deployment time.

3. Using properties files at runtime engine stopping and starting BW.

4. In command line stoping and starting the BW engine.

Take into consideration that same global variable can be applied a value of four ways simultaneously. In this case, the value that prevails is the command line, followed by the value in the property file, then indicated in TIBCO Administrator and finally the configured with TIBCO Designer.

This paper describes and details Option 3 as part of the Best Practices of Business Works. Using the properties files limits the use of TIBCO Administrator tool change as global variables.

3.1.3   Using properties files in TIBCO BusinessWorks

We recommend using a properties file per project to organize global variables, and thus set a naming convention for naming files. The following convention is recommended:

bwprop-<project name>-<environment>.prop

When the value of a global variable is set by properties file is recommended to give the value "_PROPFILE_" at design time by TIBCO Designer to indicate this fact and to avoid misuse.

The properties files are listed in the project file .TRA generated by TIBCO Administrator. The .tra file is modified as follows:

tibco.env.APP_ARGS=-p bwprop-<nombre proyecto>-<entorno>.prop -p bwprop-<nombre proyecto>-<entorno>-config.prop

The .tra files of different projects are in the domain where they have been deployed.
/tibco/tra/domain/<nombre_dominio_tibco>/application/<nombre_despliegue>

WARNING: The deployment of the project regenerates the .tra file and the changes made using the properties files will be lost.

2 comentarios: