This documentation is for WSO2 Complex Event Processor 4.0.0. View documentation for the latest release.
WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

Following are the supported inbuilt windows of Siddhi

time

<event> time(<int|long|time> windowTime)

  • Extension TypeWindow 
  • Description: Sliding time window, that holds events for that arrived during last windowTime period, and gets updated on every event arrival and expiry.
  • ParameterwindowTime: The sliding time period for which the window should hold events.
  • Return Type: Return current and expired events.
  • Examplestime(20) for processing events arrived in last 20 milliseconds. time(2 min) for processing events arrived in last 2 minutes. 

timeBatch

<event> timeBatch(<int|long|time> windowTime)

  • Extension TypeWindow 
  • Description: Batch (tumbling) time window, that holds events arrived between windowTime periods, and gets updated for every windowTime.
  • ParameterwindowTime: The batch time period for which the window should hold events.
  • Return Type: Return current and expired events.
  • ExamplestimeBatch(20) for processing events arrived every 20 milliseconds. timeBatch(2 min) for processing events arrived every 2 minutes. 

length

<event> length(<int> windowLength)

  • Extension TypeWindow 
  • Description: Sliding length window, that holds last windowLength events, and gets updated on every event arrival and expiry.
  • ParameterwindowLengthThe number of events that need to should be in a sliding length window.
  • Return Type: Return current and expired events.
  • Exampleslength(10) for processing last 10 events. length(200) for processing last 200 events. 

lengthBatch

<event> lengthBatch(<int> windowLength)

  • Extension TypeWindow 
  • Description: Batch (tumbling) length window, that holds up to windowLength events, and gets updated on every windowLength event arrival.
  • ParameterwindowLengthFor the number of events the window should tumble.
  • Return Type: Return current and expired events.
  • ExampleslengthBatch(10) for processing 10 events as a batch. lengthBatch(200) for processing 200 events as a batch. 

externalTime

<event> time(<long> timestamp<int|long|time> windowTime)

  • Extension TypeWindow 
  • Description: Sliding time window based on external time, that holds events for that arrived during last windowTime period from the external timestamp, and gets updated on every monotonically increasing timestamp.
  • ParametertimestampThe time which the window determines as current time and will act upon, the value of this parameter should be monotonically increasing. 
  • ParameterwindowTime: The sliding time period for which the window should hold events.
  • Return Type: Return current and expired events.
  • Examples: externalTime(eventTime,20) for processing events arrived in last 20 milliseconds from the eventTime. externalTime(eventTimestamp, 2 min) for processing events arrived in last 2 minutes from eventTimestamp.

cron

<event> cron(<string> cronExpression)

  • Extension Type: Window
  • Description: Cron window will output processed events periodically in a time-repeating patterns, that triggers based on time passing.
  • Parameter: cronExpression: cron expression that represents a time schedule.
  • Return Type: Return current and expired events.
  • Examples: cron('*/5 * * * * ?') will output processed events every 5 seconds.

firstUnique

<event> firstUnique(<string> attribute)

  • Extension Type: Window
  • Description: First unique window processor keeps only the first events that are unique according to the given unique attribute.
  • Parameter: attribute: attribute that should be checked for uniqueness.
  • Return Type: Return current and expired events.
  • Examples: firstUnique(ip) will return first event arriving for each unique ip.

unique

<event> unique(<string> attribute)

  • Extension Type: Window
  • Description: Unique window processor keeps only the latest events that are unique according to the given unique attribute.
  • Parameter: attribute: attribute that should be checked for uniqueness.
  • Return Type: Return current and expired events.
  • Examples: unique(ip) will return latest event arriving for each unique ip.

sort

<event> sort(<int> windowLength)

<event> sort(<int> windowLength, <string> attribute, <string> order)

<event> sort(<int> windowLength, <string> attribute, <string> order, .. , <string> attributeN, <string> orderN)

  • Extension Type: Window
  • Description: Sort Processor will holds up to windowLength events and sort them in a given order.
  • Parameter: windowLength: for the number of events the window should tumble.
  • Parameter: attribute: attribute that should be checked for the order.
  • Parameter: order: order of the attribute defined by "asc" or "desc". If neither "asc" nor "desc" is given for a certain attribute, order defaults to "asc".
  • Return Type: Return current and expired events.
  • Examplessort(5, price, 'asc') keeps the events sorted by price in the ascending order. Therefore, at any given time, the window contains the 5 lowest prices.

frequent

<event> frequent(<int> eventCount)

<event> frequent(<int> eventCount, <string> attribute, .. , <string> attributeN)

  • Extension Type: Window
  • Description: Frequent window processor will return the latest events with the most frequently occurred value for a given attribute(s). Frequency calculation for this window processor is based on Misra-Gries counting algorithm.
  • Parameter: eventCount: number of most frequent events to be emitted to the stream
  • Parameter: attribute: attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event will be considered.
  • Return Type: Return current and expired events.
  • Examples: frequent(2) will return the 2 most frequent events. frequent(2, cardNo) will return 2 latest events with the most frequently appeared card numbers.

lossyFrequent

<event> lossyFrequent(<double> supportThreshold, <double> errorBound)

<event> lossyFrequent(<double> supportThreshold, <double> errorBound, <string> attribute, .. , <string> attributeN)

  • Extension Type: Window
  • Description: Lossy frequent window processor will identify and return all events whose current frequency exceeds supportThreshold. Frequency calculation for this window processor is based on Lossy Counting algorithm.
  • Parameter: supportThreshold: support threshold value
  • Parameter: errorBound: error bound value
  • Parameter: attribute: attributes to group the events. If no attributes are given, the concatenation of all the attributes of the event will be considered.
  • Return Type: Return current and expired events.
  • Examples: lossyFrequent(0.1, 0.01) will return all the events whose current frequency exceeds 0.1, with a error bound of 0.01. lossyFrequent(0.3, 0.05, cardNo) will return all the events whose cardNo attribute's frequency exceeds 0.3, with a error bound of 0.05.

 

 

  • No labels