The following event set behaviors are available and are listed in priority order:
removeAll. Evaluate each event once and then remove all participating events from future evaluation. This is the default value. You can use the removeAll behavior if you do not want to specify another behavior in the rule.
removeOldest. Remove the oldest participating event from future evaluation.
removeNone. Keep all participating events and use them in future evaluation.
removePrevious. Remove all previous events and keep only the latest event in future evaluation
You would change the default behavior if you want to reevaluate the prior events along with new events.
For example, the events E1, E2, and E3 activate the following rule:
WHEN 3 stock WITH symbol = "XYZ"
Based on which behavior that you specify, the events are either removed or kept for future rule evaluation as shown in the following table:
Event Set Behavior
| Events Removed after Activation
| Event Remaining after Activation
|
remove previous
| E1, E2
| E3
|
You can specify a different behavior for each topic in a rule. To do so, place the topic name or topic alias in parentheses after the appropriate behavior. For example, in the following rule, the DailyStockInfo topic generates events with historical statistics for stocks:
WHEN 1 stock, 1 DailyStockInfo with sum(stock.price) as x >10 then response remove all(stock), none(DailyStockInfo)
If you create a rule that compares current stock events with historical stock events, you might want to remove all stock events but keep all DailyStockInfo events.
If you use more than one behavior with one topic, the behavior with the higher priority takes precedence.
You can define the same event set behavior using topic aliases:
WHEN 1 stock s, 1 DailyStockInfo d WITH sum(s.price) as x >10 then response remove all(s) and none(d)
You also can specify one behavior for multiple topics at the same time. To do so, place the comma separated topic aliases in parentheses after the behavior as shown in the following rule:
WHEN 1 stock s, 1 dailystockinfo d WITH sum(s.price)>10 then response remove none(s,d)