Defining Event Listeners
In an EPL monitor, an on statement specifies an event expression and a listener action.
Note: Queries do not need to set up event listeners so you cannot specify an on statement in a query. The information about defining event listeners applies only to monitors.
When the correlator executes an on statement it creates an event listener. An event listener observes each event processed by the context until an event or a pattern of events matches the pattern specified in the event listener’s event expression. When this happens the event listener triggers, causing the correlator to execute the listener action. At this point, depending on the form of the event expression, the event listener either terminates or continues listening for additional matching event patterns.
An event listener analyzes the event stream until one of the following happens:
The event listener finds the pattern defined in its event expression.
The
quit() method is called on the event listener to kill it.
The monitor that defines the event listener dies.
The correlator determines that the event listener can never trigger.
The correlator can support large numbers of concurrent event listeners each watching for an individual pattern.