Apama 10.7.2 | Developing Apama Applications | EPL Reference | Statements | Compound statements | The on statement
 
The on statement
The on statement is used to create an event listener that looks for input events that match the pattern specified by an event condition. When a matching event is detected, the event listener fires (also referred to as triggers) and the specified event listener action is executed.
A listener assignment clause is used to obtain a reference to the event listener that is created by the on statement. One can either define a new variable of type listener or specify a reference to an existing listener variable.
An Apama query cannot specify an on statement.
Example:
listener l := on ...
sequence <listener> aSequence;
aSequence[0] := on ...
The event condition specifies what events are of interest. See Event expressions.
A listener action defines the processing that will be performed when a matching event is detected and the event listener fires. The listener action can be one of the following:
*A statement
*A block
The listener action is invoked automatically by the correlator when the event condition is satisfied. This may be:
*When a matching event is detected.
*If unmatched is specified in the condition, the event matches the condition, and there are no matching event listeners that do not specify the unmatched keyword.
*If completed is specified in the condition, and any matching events have been completely processed by other event listeners.
For more information, see Specifying the on statement.