Copyright © TIBCO Software Inc. All Rights Reserved |
Global variables provide an easy way to set defaults for use throughout your project. When the project is deployed all occurrences of the global variable name are replaced with the provided global variable value, or a deploy-time override.For example, you could assign the value 7474 to the global variable RvDaemon. You can then use the variable in a Rendezvous Transport resource. At deploy time you can override the default value as needed.
• The datatype of the global variable must match the datatype accepted in the field where you use it. If the global variable is of a different type, runtime errors result.
• An exception to the above allows flexibility in numeric fields: global variables used in numeric fields can be of any type, as long as the substituted value of the field is numeric.
• A project folder called defaultVars is available but not exposed in Studio Explorer, so that you can share the global variables using source control software. It is not used for other purposes.In a new Studio project no global variables are predefined. When you import a project from an earlier version of TIBCO BusinessEvents, however, you see predefined global variables such as the following (as well as any others defined in the project).
2. Select Project > Edit Global Variables.
4. Do any of the following. (See Table 3, Global Variable Reference for a guide to the fields):
− To add a variable, click Add Variable and complete the fields.
− To add a variable group, click Add Group.
−
Using Groups Groups are used for organizing variables. Variable groups are especially useful if multiple developers share a project using a version control system. When referencing a variable that is in a group, use the complete path, for example %%mygroup/mysubgroup/myvariable%%.You must add at least one variable to a group, or the group will not be saved. If you delete all global variables in a global variable group, the group itself is also automatically deleted.
5. Save the resource. Groups and references to the defaultVars.substvar file appear in the defaultVars project folder.
Table 3 Global Variable Reference The type must match the type of the field where the global variable is used, or errors result. Deployment settable If checked, the variable is visible and settable when deploying using TIBCO Administrator. The values set at that time are saved in the project that TIBCO Administrator creates from the provided EAR file.If the checkbox is not checked, the variable is not visible in TIBCO Administrator. It is checked by default. For deployment using TIBCO Administrator. If this box is checked the value of the global variable can be set differently for each deployable instance.Used only when Deployment Settable is also checked (ignored otherwise).If checked, the variable is included when the Include all service level global variables option is selected when building the enterprise archive file.Values set at the service or service instance level are passed to the engine at runtime in the format tibco.clientVar.VariableName=value. Optional. For String and Integer types, allows you to provide a range of allowed values. The constraint field for Strings is an enumeration, for example, one, two, three. The constraint field for Integers is for a range, for example, 1-100.Note that constraints are currently not implemented in TIBCO Administrator. Non-editable field records date and time this variable was last modified.To use a global variable as the value for a project setting, drag it from the list of variables into the text box for the setting, or enter it manually using the syntax %%Variable_Group/Variable_Name%%. You must include the global variable group hierarchy, if one exists. For example, to use a global variable in a File Path field, you might enter %%myvars/myFileLoc%%.To use a global variable in the rule editor, use one of the System.getGlobalVariableAs* functions. For example:System.getGlobalVariableAsString("myvars/Hostname", "Localhost")Where myvars/Hostname is the name of the variable group and variable, and Localhost is an optional literal value to use if the variable is not found.You can override default global variable values in one of these ways, depending on how you will deploy:
− In the design time CDD file. See Overriding Global Variables in the CDD File (for Command Line Startup) in TIBCO BusinessEvents Administration.
− When starting at the command line, using the --propVar option, or using the --propFile option to specify a property file where the override properties are defined. See Starting a TIBCO BusinessEvents Engine at the Command Line in TIBCO BusinessEvents Administration.
• For deployment using TIBCO BusinessEvents Monitoring and Management component, set overrides in the MM Console. See Overriding Global Variables at Deploy Time in TIBCO BusinessEvents Administration.
• For deployment using TIBCO Administrator, set overrides in the TIBCO Administrator UI. See Deploying a Project in a TIBCO Administrator Domain in TIBCO BusinessEvents Administration.You can also override variable values when starting an engine directly at the command line. You can pass the overrides directly, using the --propVar option, or in a file, referenced using the -p option.See Deploying a Project in a TIBCO Administrator Domain in TIBCO BusinessEvents Administration for the complete procedure.You can override variables at the deployment level or at the service level. Values set at the deployment level are used in all deployed engines. Values set at the service level are used for the specific engine you are deploying.Service settable global variables are only available if the "Include All Service Level global variables" checkbox in the Build Enterprise Archive dialog is checked (see Building an Enterprise Archive (EAR File)).
Copyright © TIBCO Software Inc. All Rights Reserved |