The latest version for DAS is WSO2 Data Analytics Server 3.1.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
||
Skip to end of metadata
Go to start of metadata

Introduction

This sample demonstrates how to set up an execution plan with time windows and length windows and perform a join (with a condition) to trigger an output. This sample uses Event Simulator for inputs and the logger publisher for logging the outputs to the DAS console.

The execution plan used in this sample is as follows:

from TempStream[temp > 30.0]#window.time(1 min) as T 
  join RegulatorStream[isOn == false]#window.length(1) as R
  on T.roomNo == R.roomNo
select T.roomNo, T.temp, R.deviceID, 'start' as action
insert into RegulatorActionStream ;

The first query does the following.

  • Processes the events received through the TempStream, filters events with temp > 30.0 condition and inserts the events that satisfy the filter condition into a 1-minute time window (renamed as T).
  • Filters events coming through the RegulatorStream with the isOn == false condition, and inserts the events that satisfy the condition into a length window of 1 event (renamed as R).
  • Performs a join between the above two windows, with the condition T.roomNo == R.roomNo, this creates tuples consisting of the events matching this condition as in SQL.
  • Selects the roomNo from T events, temp from T events, deviceID from R, and also inserts an additional attribute named action with the value start.
  • Emits those events as output events through the RegulatorActionStream stream.

Prerequisites

Set up the prerequisites required for all samples.

Building the sample

Start the WSO2 DAS server with the sample configuration numbered 0105. For instructions, see Starting sample CEP configurations.

This sample configuration points the default Axis2 repo to <DAS_HOME>/samples/cep/artifacts/0105 (by default, the Axis2 repo is <DAS_HOME>/repository/deployment/server).

Executing the sample

  1. Log into the DAS management console that is located at https://<DAS_HOST>:<DAS_PORT>/carbon.

  2. Go to Tools -> Event Simulator. The following files are displayed under the Send multiple events section.
    • events.csv: This file contains sample events to simulate the event flow of the event stream named TempStream:1.0.0.
    • regularEvents.csv: This file contains sample events to simulate the event flow of the event stream named RegularStream:1.0.0.
    Click Play for both files to start sending sample events in these files.
  3. View the output events received from the DAS console. This sample uses the logger adaptor to log output events to the console.

    The output of the consumer sending events from the producer is logged as shown in the following example.

  • No labels