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 CEP console.
The execution plan used in this sample are as follows:
The first query,
- Processes the events received through the TempStream, filters events with temp > 30.0 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 condition isOn == false, 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 will create tuples consisting of the events matching this condition as in SQL.
- Selects the roomNo from T evnets, temp from T events, deviceID from R, and also inserts and additional attribute named 'action' with the value 'start'.
- Emits those events as output events through the RegulatorActionStream stream.
See Prerequisites in CEP Samples Setup page.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0105. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Points the default Axis2 repo to
<CEP_HOME>/sample/artifacts/0105(by default, the Axis2 repo is
Executing the sample
Log into the CEP management console which is located at https://localhost:9443/carbon.
- 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
See the output events received from the CEP console. This sample uses the logger adaptor to log output events to the console.
For example, given below is a screenshot of the output of the consumer sending events from the producer: