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:
The first query does the following.
- Processes the events received through the
TempStream, filters events with
temp > 30.0condition and inserts the events that satisfy the filter condition into a 1-minute time window (renamed as
- Filters events coming through the
isOn == falsecondition, and inserts the events that satisfy the condition into a length window of 1 event (renamed as
- 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
R, and also inserts an additional attribute named
actionwith the value
- Emits those events as output events through the
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
Executing the sample
Log into the DAS management console that is located at
- 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
regularEvents.csv: This file contains sample events to simulate the event flow of the event stream named
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.