Developing Apama Applications > Apama EPL Reference > Events and Event Listeners > Event lifecycle
Event lifecycle
An event enters the correlator in one of the following ways:
*An event is received from another component, such as the engine_send utility, an adapter, another correlator, or a process that is using the Apama client API.
*An EPL program creates an event instance and executes an enqueue statement.
*An EPL program creates an event instance and executes a route statement.
For the first two cases above, the correlator places the event on the input queue of each public context. For routed events, the correlator places the event on the input queue of only the context that contains the monitor instance that routed the event. When you specify the enqueue Event to Context statement, the event goes to only the specified context.
When the event gets to the front of the context’s input queue, the correlator evaluates the event to determine if it is a match for any active event listeners in that context. That is, the correlator checks whether there are any event listeners in that context that are watching for that particular event. If there is a match, the match triggers the event listener. This means that the correlator executes the actions defined in the matching event listener.
It is possible for the actions defined in the event listener to route one or more events back to the context’s input queue. A routed event goes right to the front of the context input queue. When the correlator is finished processing the event that triggered the event listener action, the correlator evaluates any routed events before it moves on to the event that was on the input queue after the matching event.
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.