Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

IterativeCondition defines a user-defined condition that decides if an element should be accepted in the pattern or not. The condition iterates over the previously accepted elements in the pattern and decides to accept a new element or not based on some statistic over elements. The call to Context#getEventsForPattern(name) has to find the elements that belong to the pattern among the elements stored by the NFA. The cost of this operation can vary, so when implementing your condition, try to minimize the times the method is called. In certain aggregation scenarios, for example filtering goods with more than 1,000 orders within 10 minutes, aggregation operation needs to perform in IterativeCondition. The aggregation behaivor causes the repeated calculation of the aggregation state, because an aggregation state may execute multiple transitions with condition and each condition invoker will be accumulated once. AggregationCondition is proposed to define the IterativeCondition with aggregation and filter the aggregation state with accumulator. The aggregation state is consistent within the lifecycle of a matching NFA, on other words, user doesn't need to pay attention to when the aggregation state is initialized and cleaned up. In addtion, the introduction of AggregationCondition reduces the cost of the operation of Context#getEventsForPattern(name) for aggregation.

Public Interfaces


The following public interfaces are introduced to support IterativeCondition with Aggregator functional requirement.

...