Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3
minLevel3

Introduction

This sample demonstrates how to set up an execution plan to process events of one stream and forward the processed events to two other streams. This with triggers. This sample uses the Event simulator for inputs and the logger publisher for logging the outputs to the CEP console.

...

  • The following query triggers an event in the periodicalTriggerStream event stream every 5 seconds. The purpose of this trigger is to generate events in the periodicalTriggerStream event stream in order to merge it with the sensorStream event stream.

    Code Block
    languagesql
    define trigger periodicalTriggerStream at every 5 sec ;
  • The following query forwards a processed event as an output to the cronTriggerStream every 10 seconds.

    Code Block
    languagesql
    define trigger cronTriggerStream at '*/10 * * * * ?' ;
  • The following query merges the periodicalTriggerStream and sensorStream event streams. Only the values of the attributes specified in the query are merged. Attribute values are taken from the sensorStream event stream and inserted into the periodicalTriggerStream event stream.

    Code Block
    languagesql
    from periodicalTriggerStream join sensorStream#window.time(10 sec)
    select meta_timestamp, meta_isPowerSaverEnabled, meta_sensorId, meta_sensorName, correlation_longitude, correlation_latitude, triggered_time, humidity, sensorValue
    insert into periodicalTriggeredSensorStream;
  • The following query merges the cronTriggerStream and sensorStream event streams.  Only the values of the attributes specified in the query are merged. Attribute values are taken from the sensorStream event stream and inserted into the cronTrigerredSensorStream event stream.

    Code Block
    languagesql
    from cronTriggerStream join sensorStream#window.time(10 sec)
    select meta_timestamp, meta_isPowerSaverEnabled, meta_sensorId, meta_sensorName, correlation_longitude, correlation_latitude, triggered_time, humidity, sensorValue
    insert into cronTriggeredSensorStream;

Prerequisites

See Prerequisites in the CEP Samples Setup page.

Building the sample

Start the WSO2 CEP server with the sample configuration numbered 0119. For instructions, see Starting sample CEP configurations. This sample configuration does the following:

Executing the sample

Follow the steps below to execute the sample.

...