WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

Introduction

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:

from sensor_stream 
select meta_sensorId, correlation_longitude, correlation_latitude, humidity, sensorValue as value
insert into sensor_value_projected_stream;

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 select clause, 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. 

Prerequisites

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 <CEP_HOME>/repository/deployment/server).

Executing the sample

  1. Open a terminal, go to <CEP_HOME>/samples/cep/producers/wso2-event and run the following command from there.

     

    ant -DstreamId=org.wso2.event.sensor.stream:1.0.0 -Dsn=0101

     
    It builds and runs the wso2event producer, which will send sensor data to the CEP server.

  2. 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:

  • No labels