# For Substation ES Trigger Service

This TIBCO ActiveMatrix BusinessWorks 6.x project uses the Mainframe TCP API to establish the connection to Substation ES TCP interface. Once started, it listens and waits for the messages sent from Substation ES trigger service.

To use the trigger sample project, you must set the following process variables of the substationtriggerservices.module. SubstationES-Trigger-Service process to match the corresponding running Substation ES setup:

Process Variables | Description
--- | ---
URL | The URL of the TCP interface to which Substation ES listens to
UserID | The z/OS user ID
Password | The password corresponding to the z/OS user ID
Trigger-Service-Name | The trigger service which Substation ES will publish on
Retry | The number of retries allowed to connect

Note: For the application to run correctly, ensure that S7R-TCP bundle is included in the configuration for ActiveMatrix BusinessWorks.

Process Flow

Upon initiating the process, the connect activity is called which is a Java method for connection (found in TriggerService.java). After connecting, the process enters a loop until a "no data" condition.

- In the loop, do a GetString java method (found in TriggerService.java)
  - It does an infinite wait for data (Get-Trigger-Data)
  - When the "Get-Trigger-Data" activity returns - it eithert has data or a lost connection error
  - "lost" connection error will return zero length data which will result in the loop ending
  - Data returned is a String and is passed to "Process-Trigger-Data" for handling
  - "Process-Trigger-Data" calls process "Handle-Trigger-Data" which logs the message

- After exiting the loop - call "Disconnect" to cleanup TCP

Copyright © TIBCO Software Inc. All rights reserved.