Apama Documentation : Developing Apama Applications : Developing Apama Applications in EPL : Defining Queries : Defining query input : Behavior when there is more than one input
Behavior when there is more than one input
The correlator orders the events in a window according to the time it processes each event, that is, the time it adds the event to its window. When a query defines more than one input then, for each partition, the correlator maintains a single time-order for all events in all windows.
Suppose the correlator adds an event to a window and within 0.1 seconds the correlator adds a different event to the same window or to another window in the same partition. Outside a query, these two events might have the same timestamp because default correlator behavior is to increment the timestamp only every tenth of a second. In a query, however, if an event is added to a window within 0.1 seconds after another event was added to a window, the correlator assigns the second event a timestamp with enough significant digits to ensure that time order is preserved. The following code fragment shows the result of calling the getTime() method on two events that arrive within 0.1 seconds of each other:
find E:e -> F:f {
print e.getTime().toString(); // Yields "1365761429.1"
print f.getTime().toString(); // Yields "1365761429.100001"
}
The order of the events is important when the event pattern in a find statement specifies the followed-by operator. Consider this example:
query Q {
inputs {
A() key k retain 20;
B() key k retain 10;
}
find A:a -> B:b { ... }
}
This pattern does not trigger when the correlator adds an A event to the A window. But if there is already an A event in the A window then this pattern triggers when a B event is added to the B window.
In a partition, at any one time, it is possible for the set of windows to contain multiple sets of events that, each taken in isolation, would match the defined event pattern. In this case, the event matching policy determines which of the candidate sets triggers an action. See Event matching policy for a description of how the query chooses the event set that triggers an action. To illustrate event matching policy, that topic provides an example of query behavior when there is more than one window.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback