Developing Apama Applications > Apama 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 expression. When a matching event is detected, the event listener fires (also referred to as triggers) and the specified event listener action is executed.
OnStatement
Rule components
The ListenerAssignment 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.
Example
listener l := on ...
sequence <listener> aSequence;
aSequence[0] := on ...
The EventExpression is an event expression that specifies what events are of interest. See Event expressions.
The ListenerAction defines the processing that will be performed when a matching event is detected and the event listener fires.
ListenerAction
The ListenerAction can be one of the following:
*Name of a monitor action
*A statement
*A block
The ListenerAction is invoked automatically by the correlator when the event expression is satisifed. This may be
*When a matching event is detected.
*If unmatched is specified in the expression, the event matches the expression, and there are no matching event listeners that do not specify the unmatched keyword.
*If completed is specified in the expression, and any matching events have been completely processed by other event listeners.
If an action name is specified instead of a block, then it must be an action that does not return a value and that does not have any parameters.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.