WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

Versions Compared

Key

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

Siddhi Aggregate Function consumes zero or more parameters  for for each event and output outputs a single attribute having with an aggregated results result based in on the input parameters as an output. This could be used with in conjunction with a window in order to find the aggregated results based on the a given window like such as the Aggregate Function operator.

To Ti implement a custom Aggregate Function, create aggregate function, follow the procedure below.

  1. Create a class extending

...

  1. the org.wso2.siddhi.core.query.selector.attribute.aggregator.AttributeAggregator

...

  1. .
  2. Create an appropriate .siddhiext extension mapping file

...

  1. .
  2. Compile the class

...

  1. .
  2. Build the jar containing the .class and .siddhiext files.
  3. Add

...

  1. the jar to the Siddhi class path.

...

  1. If you need to run them on WSO2 CEP, add

...

  1. it to the <CEP_HOME>/repository/components/dropins directory.

For example,  Aggregate Function extension created with namespace "custom" and function name "std" an aggregate function extension with custom as the namespace and std as the function name can be referred in the a query as follows:. 

Code Block
languagesql
linenumberstrue
from pizzaOrder#window.length(20)
select custom:count(orderNo) as totalOrders
insert into orderCount;

...