Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Introduction

This sample demonstrates how to set up an execution plan to perform calculations over time by aggregating events. The queries here use time windows, time batch windows to aggregate event over time. This sample uses Event simulator for inputs and the logger publisher for logging the outputs to the CEP console.

...

  • Processes the events received through the TempStream.
  • When selecting the attributes, concatenate roomNo and avg(temp) renamed as avgTemp which is the average of the temperature for each room from the start. 
  • Emits those events as output events through the AvgTempFromStartStream.

Prerequisites

See Prerequisites in CEP Samples Setup page.

Building the sample

Start the WSO2 CEP server with the sample configuration numbered 0104. For instructions, see Starting sample CEP configurations. This sample configuration does the following:

  • Points the default Axis2 repo to <CEP_HOME>/sample/artifacts/0104 (by default, the Axis2 repo is <CEP_HOME>/repository/deployment/server).

Executing the sample

  1. Log into the CEP management console which is located at https://localhost:9443/carbon.

     

  2. Go to Tools -> Event Simulator. Under the 'Multiple Events' section, you can see the listed 'events.csv' file which contains some sample data. Click 'play' to start sending sample events from the file.
  3. See the output events received from the CEP console. This sample uses the logger adaptor to log output events to the console. Since this execution plan uses 1 minute time windows, observe the results for a few minutes to get all results from different queries.

    For example, given below is a screenshot of the output of the consumer sending events from the producer: