[id='cep-sliding-windows-con_{context}']

= Sliding windows of time or length

In stream mode, the {RULE_ENGINE} can process events from a specified sliding window of time or length. A sliding time window is a specified period of time during which events can be processed. A sliding length window is a specified number of events that can be processed. When you declare a sliding window in a DRL rule or Java application, the {RULE_ENGINE}, at compile time, identifies and creates the proper internal structures to use data from only that sliding window to evaluate that rule.

For example, the following DRL rule snippets instruct the {RULE_ENGINE} to process only the stock points from the last 2 minutes (sliding time window) or to process only the last 10 stock points (sliding length window):

.Process stock points from the last 2 minutes (sliding time window)
[source]
----
StockPoint() over window:time(2m)
----

.Process the last 10 stock points (sliding length window)
[source]
----
StockPoint() over window:length(10)
----
