Constants, Operator Parameters, Module Parameters and Substitution Variable Configuration

Constants, Operator Parameters, Module Parameters and Substitution Variable Configuration

book

Article ID: KB0073779

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10.0 to 10.5

Description

There are several ways to add runtime parameters to a StreamBase application. This article provides simple syntax configuration examples.

Resolution

Important Note:

Both the operatorParameters and constantsOverwrite configuration sections are deprecated as of TIBCO Streaming 10.5.0. The operatorParameters and constantsOverwrite configuration is replaced by the moduleParameterSettings and containerParameterSettings configuration sections. Constants defined with the Definitions tab of a module are expected to not change by configuration. If the value is to change based on configuration and substitution variable values, then use a Module Parameter and not a Constant. Please see the current product documentation section:
  TIBCO Streaming > Authoring Guide > Constants, Variables, and Parameters

Using Constants and Operator Parameters

Constants and Operator Parameters are configured in a fragment "sbengine" configuration.

To run an application from SB Studio with Constant and Operator Parameter values specified by an "sbengine" configuration, name the engine configuration file a unique engine name, for example "myengine", and refer to that engine in the Run Configuration, Parameters tab, Engine name:Specified "myengine" (no quotes):
Run Configuration dialog with engine name set

The engine configuration file may then set parameters and constants as so (example):

myengine.conf
 name = "myengine" version = "1.0.0" type = "com.tibco.ep.streambase.configuration.sbengine" configuration = {   StreamBaseEngine = {     streamBase = {       operatorParameters = {         MyParam = "MyValue"         "MyParam.with.dots.quoted" = "AnotherValue"       }       constantsOverwrite = {         CONSTANT1 = "value1"         CONSTANT2 = "value2"       }     }   } }
 

Using Module Parameters

Module Parameters are configured in a deployment "sbengine" configuration and require special handling in SB 10.2 when launched in Studio using a Run Configuration. This special handling requirement may be removed in a later release.

To run an application from SB Studio with with Module Parameter replacement specified by an "sbengine" configuration, name the engine configuration file a unique engine name, for example "simple_deploy" and refer to that engine in the Run Configuration, Parameters tab, Engine name:Specified "simple_deploy" (no quotes). The engine configuration file may then set Module Parameters (and Operator Parameters and Constants) as so:

simple_deploy.conf
 name = "simple_deploy" type = "com.tibco.ep.streambase.configuration.sbengine" version = "1.0.0" configuration = { 	StreamBaseEngine = { 		streamBase = { 		  operatorParameters = { 			"A.OutputAdapter.messageIdentifier" = "Tick" 		  }		         constantsOverwrite = {           CONSTANT1 = "value1"           CONSTANT2 = "value2"         }       } 	} 	EventFlowDeployment = {     modules = [       {         moduleName = "com.sb.support.simple.simple"         moduleParameters = {           REP1 = "'SET'"         }         containerName = "A"       }     ]	   } }


Special Handling in SB 10.2

There is a limitation in StreamBase Studio version 10.2 when a deployment "sbengine" configuration is referenced from a Studio Run Configuration. The Run Configuration always launches the referenced application in the "default" container, but the "containerName" setting cannot reference the "default" container (which causes a runtime conflict). It must instead reference an additional container by another name (in the above example, "A"). This means that when using a deploy configuration (to set module parameters) with a Run Configuration, to avoid container conflicts the Run Configuration must run an empty .sbapp that does nothing (which will run in the "default" container) and the actual .sbapp fragment to test needs to be specified in the deploy configuration settings "moduleName" and "containerName". This allows a single instance of the correct application to run in its own container and the Operator Parameters, Module Parameters, and Constants may then all affect the correct application in the non-default container. This behavior is described in the SB 10.2 Known Limitations release notes as items SB-42324, SB-30773, and SB-30846. This limitation does not occur when running the application from the 'epadmin' command-line. This Studio limitation is expected to be removed in a future release.


Using Substitution Variables

To substitute Operator Parameter, Constant, and Module Parameter values at launch, use the epadmin  substitutions parameter and provide substitution variables into the engine configuration as so:

simple_deploy.conf
 name = "simple_deploy" type = "com.tibco.ep.streambase.configuration.sbengine" version = "1.0.0" configuration = { 	StreamBaseEngine = { 		streamBase = { 		  operatorParameters = { 			"A.OutputAdapter.messageIdentifier" = ${SUB1:-Dep1} 		  }		           constantsOverwrite = {             REP2 = ${SUB2:-'Dep2'}           } 		} 	} 	EventFlowDeployment = {     modules = [       {         moduleName = "com.sb.support.simple.simple"         moduleParameters = {           REP1 = ${SUB3:-'Dep3'}         }         containerName = "A"       }     ]	   } }

Execution Examples

1. Execution Example using Substitution Variables:

Run:
epadmin install node nodename=A.example application=simple_app.zip substitutions="SUB1=Tick,SUB2=CmdConst,SUB3=CmdModParam"
epadmin servicename=A.example start node


Output:
tail -f A.example/logs/default-engine-for-com.sb.support.simple.log
2017-12-07 16:55:00.004000-0500 [2700:AsyncLogger] INFO  Tick: 2017-12-07 16:55:00.000-0500,CmdModParam,CmdConst

2. Execution Example using Substitution Variables set by environment variables:

Run:
set EV1=NewTick
set EV2='NewConst'
set EV3='NewModParam'
epadmin install node nodename=A.example application=simple_app.zip substitutions="SUB1=%EV1%,SUB2=%EV2%,SUB3=%EV3%"
epadmin servicename=A.example start node


Output:
tail -f A.example/logs/default-engine-for-com.sb.support.simple.log
2017-12-07 17:02:38.013000-0500 [14980:AsyncLogger] INFO  NewTick: 2017-12-07 17:02:38.000-0500,NewModParam,NewConst

Note: Quote the substitution value appropriately if it will be used in an EventFlow expression so it is recognized as a String value and not a Field name.


 

Issue/Introduction

Examples of use in StreamBase 10.5 and prior