This sample demonstrates how to set up an execution plan with a basic pass-through/projection query. It selects some of the attributes of each incoming event and emits an output event with the selected attributes. This sample uses
wso2event for both inputs and outputs.
The query used in this sample is as follows:
The above query,
- Processes the events received through the sensor_stream
- Selects the attributes (meta_sensorId, correlation_longitude, correlation_latitude, humidity, sensorValue) specified under the
selectclause, from each event received.
- When selecting the attributes, it also renames the sensorValue attribute name as value.
- Emits those events as output events through the sensor_value_projected_stream
Since we do not perform any processing apart from selecting a few attributes, this is considered as a pass-through query.
Set up the prerequisites required for all samples.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0101. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Points the default Axis2 repo to
<CEP_HOME>/samples/cep/artifacts/0101(by default, the Axis2 repo is
Executing the sample
Open a terminal, go to
<CEP_HOME>/samples/cep/producers/wso2-eventand run the following command from there.
It builds and runs the
wso2eventproducer, which will send sensor data to the CEP server.
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: