Apama Documentation : Developing Apama Applications : Developing Apama Applications in EPL : Defining Event Listeners : How the correlator executes event listeners : Evaluating event listeners for all A-events followed by B-events
Evaluating event listeners for all A-events followed by B-events
You might want to alter the behavior described in the previous topic, and have the event listener match on more of the combinations. To do this, specify the all operator in the event expression.
If the event listener's specification was rewritten to read:
on all A() -> B() success();
the event listener would match on every A and the first B that follows it.
The way this works is that upon encountering an A, the correlator creates a second event listener to seek the next A. Both event listeners would be active concurrently; one looking for a B to successfully match the pattern specified, the other initially looking for an A. If more As are encountered the procedure is repeated; this behavior continues until either the monitor or the event listener are explicitly killed.
Therefore on all A() -> B() would return {A1, B1}, {A2, B1} and {A3, B3}.
Note that all is a unary operator and has higher precedence than ->, or and and. Therefore
on all A() -> B()
is the same as both of the following:
on (all A()) -> B()
on ( ( all A() ) -> B() )
The following table illustrates how the execution of on all A() -> B() proceeds over time as the pattern of input events is processed by the correlator. The timeline is from left to right, and each stage is labeled with a time tn, where tn+1 occurs after tn. To the left are listed the event listeners, and next to each one (after the ?) is shown what event template that event listener is looking for at that point in time. In the example, assuming L was the initial event listener, L', L'' and L''' are other sub-event-listeners that are created as a result of the all operator.
Guide to the symbols used:
indicates a specific point in time when a particular event is received
indicates that at that time no match was found
indicates that the listener has successfully located an event that matches its current active template
is used to indicate that a listener has successfully triggered
indicates that a new listener is going to be created.
The master event listener denoted by on all A() -> B() will never terminate as there will always be a sub-event-listener active that is looking for an A.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback