This documentation is for WSO2 CEP 3.0.0. View the home page of the latest release.

Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Introduction

This sample demonstrates how to set up an execution plan with a basic pass through query. It selects some of the attributes of each incoming event and emits an output event with the selected attributes.

The query used in this sample is as follows:

from InMediationStatsStream
select meta_host, timestamp, resource_id, direction, fault_count, count
insert into OutMediationStatsStream;

In the above query, we are going to process the events received through the 'InMediationStatsStream'. From each event received, we'll be selecting the attributes specified under the select clause. (which are meta_host,timestamp,resource_id,direction,fault_count,count). Then those events will be emitted as output events through the OutMediationStatsStream. Since we are not doing any processing apart from selecting a few attributes, this is considered as a pass-through query. 

This sample uses wso2event for both inputs and outputs.

 

Prerequisites

For a list of prerequisites, please refer to the prerequisites section in Setting up CEP Samples.

 

Building the Sample

  1. Start the WSO2 CEP server with the sample number as ./wso2cep-samples.sh -sn 0101  (or on Windows, wso2cep-samples.bat -sn 0101). This will start up the server with the configuration files required for this sample.

    Here when executing the sample with above command, there are some operations done in the background. There is a file called "stream-manager-config.xml" copied to the <CEP_HOME>/repository/conf from the artifacts directory of the sample. This file will be used in the server startup to create the stream definitions to run the sample.

    Then, default Axis2 repo will be pointed to the directory <CEP_HOME>/sample/artifacts/0101 (by default Axis2 repo is <CEP_HOME>/repository/deployment/server). There will be limited functionality in sample server startup mode, so don't perform other tasks in the server when it is start-up in the sample mode.

Executing the Sample

  1. Open another terminal and switch to <CEP_HOME>/samples/consumers/wso2-event and run ant from there. This will build the sample wso2event consumer and execute it. Do not close this terminal as it is required to keep the server running in order to receive events and view them.
  2. From another terminal switch to <CEP_HOME>/samples/producers/mediation-stats/ and run ant from there. This will build and run the wso2event producer which will send some mediation statistics data to the CEP server. From this terminal, you will be able to view the details of the events sent.

    Note

    To configure host, port, username, password and No. of events use -Dhost=xxxx -Dport=xxxx -Dusername=xxxx -Dpassword=xxxx -Devents=xx.

    For example : ant -Devents=10

  3. Once the step 3 is done successfully, you will be able to see the output events received from the CEP via the terminal opened in step 2.
  4. Below is the console output of the consumer when sending 5 events from the producer. 

 

 

 

  • No labels