Computation pattern

A computation rule is defined by the computation pattern. It applies a computation (through an expression) to collected events as each event is received within a time interval. It is a stateful rule.

Overview

The computation pattern runs a computation function, as defined by the <computeFunction> element in the rule language, against each event that is accepted over a period of time. The time period is indicated by a mandatory time window, as defined by the <timeWindow> element.

Conditions under which the rule response runs

With the computation pattern, the rule response runs when the time window is complete, as defined by the <onTimeWindowComplete> element. The value of the computation is available during the <onTimeWindowComplete> action.

Example usage of this rule pattern

Assume that an application is processing customer order events. An example usage of the computation pattern is a rule that does the following:
Each time an event is received, the total value of the order is added to the total value of all orders that have occurred during the specified time period, and the updated total value of all orders is published within a user interface.
Related reference
Computation rule summary