Creating a listener
trigger
The listener map definition is surfaced at run time through a listener trigger. A trigger is executed when a event occurs. There are different types of events: schedule (or time based) events, data driven events, and listener maps. The listener maps occur when the node receives a message from an enterprise application defined in a listener. The contents of the message are defined by a listener map definition.
Assumptions
Before you begin to create the listener trigger, the following should have occurred:
- You reviewed Configuring listeners.
- You created a listener map and associated a predefined listener with it.
Procedures
To create a listener trigger, follow these steps:
- From Workbench left pane, go to the appropriate
node, and then click the Projects
icon.
The Projects tab appears. - Double-click the project you want to add the
trigger to.
The project tab appears. - Click the New button from the
bottom of the project tab.
The Trigger window appears. - In the Name box, type a name for
the trigger. A listener trigger name can be up to 64
characters and include letters, numbers, spaces, and
hyphen and underscore characters. Only letters and
numbers can be used for the first character of the
name. Spaces are removed from the end of the
name.
- Click the Settings tab.
- Set the parameters as follows:
- In the Max in Progress box, type the number of triggers that must complete processing before another trigger is allowed to execute. If the number of executing triggers exceeds the number specified, the triggers are stored in a pending queue if queue is enabled, otherwise they overflow.
- From the Reporting drop-down list accept the Off default value.
- In the Max Exec Time (ms) box, type a value in milliseconds for the maximum execution time for the trigger. If the trigger exceeds this value, a warning message is logged in the Exceptions Log.
- In the Queue Size box, type a value that will represent the number of items to hold in the trigger queue. For this example, 20.
- From the Editor mode list
accept the default value. The Editor
mode allows you to specify a method
for creating actions for the trigger. You can
drag and drop an action (Canvas) or select an
action from a list (List).
- Click the Event tab.
- From the Trigger Event Type
drop-down list, select Listener.
The window changes to accommodate a listener trigger. - From the Listener Map Definition drop-down list, select the
listener map you want to use for the trigger. The list
displays all the listener map definitions created on
the current node. For this example, select
GetBinInformation.
The next step is to specify an action in the trigger. The following assumes that you have selected the action from a list. - From the Event tab, under the
Actions section, click
Add.
The New Action window appears. - Select Set, and then click
Add.
The right pane changes to accommodate the Set action.
Within the Set pane, there are Set Source and Set Destination sections.
The next step is to specify a map variable that was defined in the GetBinInformation listener map as the source. - Under Source, next to
Constant, click the down-arrow to
display a list of variables.
A list of variables appears. - Expand the list of variables to locate
EventVariables, and then expand
EventVariables
For this example, the map variables that were defined in the Input tab of the GetBinInformation listener map definition appear.
For listener triggers, the values of these source map variables can be used as input for Transaction actions, Expression actions, or in Set actions as shown in this example. - Select the appropriate variable to use as the
source. For this example, BinNumber.
The variable is added to the Variable box.
The next step is to specify an output map variable that was defined in the Output tab of the GetBinInformation listener map as the destination variable. Values can be written to these variables when the trigger executes. - Under Destination, next to the
Variable box, click the down-arrow to
display a list of variables.
A list of variables appears. - If necessary, expand the list of variables to
locate the EventVariables, and then
expand EventVariables
The variables created for the GetBinInformation listener map are listed. - For this example, select
CurrentBinLevel.
The variable name is added to the Variable box.
The values written to the listener map output variables
will become the contents of the Listener Reply message sent
back to the enterprise system upon completion of the
listener trigger.
The trigger is completed.
- Click Validate.
- A message will say whether or not the validation
was successful. Click OK.
- If no errors are received, click
Save.
The name of the trigger is added to the project
tab.
You must start the trigger and also start the listener
associated with the trigger.