How to use operator parameters to change adapter configuration in StreamBase 10

How to use operator parameters to change adapter configuration in StreamBase 10

book

Article ID: KB0073694

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10.0 through 10.5

Description

I have multiple uses of an adapter and need to set my configuration to use one configuration in our test environment and another in our production deployment environment. How can I control this without having to rebuild my application with different configurations in each environment?

Resolution

Important: Note that this article applies only to 10.5 and prior. In the 10.6 and later releases, the use of Operator Parameters (Global Parameters) is deprecated in favor of Module Parameters and Container Parameters which provide better control of scope and configuration reusability. Please see the current product documentation topic:
    TIBCO Streaming > Configuration Guide > StreamBase Configuration Types > StreamBase Engine Configuration
  • ParameterSettingsGroup Root Object
  • EventFlowDeployment Root Object
These are very powerful when used with substitutions described in the product documentation here:
    TIBCO Streaming > Configuration Guide > HOCON Configuration Introduction > HOCON Substitution Variables

For 10.5 and Prior

Most adapters have a property which identifies the target server or configuration name. For example, for the EMS adapter this is "serverName". The operator parameter names can be found by right-clicking on the adapter in the Studio EventFlow editor and choosing View Source, which shows the XML definition of the adapter.

The server engine HOCON configuration allows these properties to be set using the operatorParameters section of the StreamBase configuration.

To distinguish which EMS operators need a specific serverName, the operatorParameters section needs the full runtime address of each EMS operator. Find these by inspecting a running instance of your application. With the node running, get the full list of operators using command:
  epadmin servicename=Node.Cluster display operator
This will have output like:
  [Node.Cluster] Engine = default-engine-for-com.sample.adapter.jms
  [Node.Cluster] Path = default.moduleA.moduleB.EMSConnect

Find your operators by name to identify the full Path to use. If your EMS operators all have "EMS" in the name, use:
  epadmin servicename=Node.Cluster display operator | FIND "EMS"  
 
(or 'grep "EMS"' on Linux)
to filter the output (there may be hundreds of operators in your running application).

For each operator, create a separate operatorParameters entry as so:
configuration = {
    StreamBaseEngine = {
        streamBase = {
            operatorParameters = {
                "default.moduleA.moduleB.EMSConnect.serverName" = "${TARGETEMS:-EMS-SERVER}"    
                "default.moduleA.moduleB.ReceiveEMSMsg.serverName" = "${TARGETEMS:-EMS-SERVER}"    
                "default.moduleA.moduleB.SendEMSMsg.serverName" = "${TARGETEMS:-EMS-SERVER}"    

                "default.moduleC.EMSConnect.serverName" = "${TARGETEMSTWO:-EMS-SERVER}"    
                "default.moduleC.ReceiveEMSMsg.serverName" = "${TARGETEMSTWO:-EMS-SERVER}"    
                "default.moduleC.SendEMSMsg.serverName" = "${TARGETEMSTWO:-EMS-SERVER}"    

                "otherContainer.EMSConnect.serverName" = "${TARGETEMSTHREE:-EMS-SERVER}"    
                "otherContainer.ReceiveEMSMsg.serverName" = "${TARGETEMSTHREE:-EMS-SERVER}"    
                "otherContainer.SendEMSMsg.serverName" = "${TARGETEMSTHREE:-EMS-SERVER}"    
            }
...

The TARGETEMS, TARGETEMSTWO, TARGETEMSTHREE values may be overridden by a substitution variable. The text after the ":-" is the default value.

Without changing the Application Archive ZIP-file, you should then be able to use 'install node' commands:
  epadmin install node nodename=MyNode.MyCluster application=App.zip substitutions="TARGETEMS=BuServer-Dev-EMS"
  epadmin install node nodename=MyNode.MyCluster application=App.zip substitutions="TARGETEMS=BuServer-UAT-EMS"

  epadmin install node nodename=MyNode.MyCluster application=App.zip substitutions="TARGETEMS=BuServer-Prod-EMS"

With multiple substitutions to set at the same time, we recommend you use epadmin option substitionFile=substitutions.txt where each file line has a separate substitution as a name=value pair to set the substitution values.



 

Issue/Introduction

Command and configuration example