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

Version 1 Next »

Introduction

This sample demonstrates how to set up an execution plan with simple filter. It checks for delayed flight arrival and add the specific related flight event to the stream called delayedFlightStream. 

The query used in this sample is as follows:

from flightStatsStream[status != 'On-Time']
select flightName, flightId, flightType, arrivalTime, trackNo
insert into delayedFlightStream  

This sample has used jms queues for the processing.

Prerequisites

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

  • Need to add necessary ActiveMQ jms related jars to the <CEP_HOME>/repository/components/lib directory of the CEP server (Please refer this ). Start the ActiveMQ server before CEP server starts. 

Building the Sample

  1. Start the WSO2 CEP server with the sample number as ./wso2cep-samples.sh -sn 0103  (or on Windows, wso2cep-samples.bat -sn 0103). 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/0103 (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/log-service and run the below command. This will build the sample axis2 sample log service and deploy in the axis2 repository that is relevant to the specified sample. After proper deployment, the web service will be able to receive messages sent from the CEP server. Below you can see the logs in CEP server when LogService.aar is deploying.

    ant -DsampleNo=0102

  2. Then, We need to Configure the LogService in order to receive the output events emitted by the CEP server under the PurchaseOrders topic. Here we will be creating PurchaseOrders topic in the local broker and subscribe  LogService on that topic.
  3. Click on "Add" menu item under "Topics" Menu in Manage section of the left panel. Then Specify the topic name in the topic input text box, in this case topic name is : "PredictedStockQuotes" (the output topic) and click on 'Add Topic' button. This will add the topic to the server and you will be directed to the Topic Browser page.
  4. Once you click on the topic in topic browser page you will be able see four links as in the bellow image. Click in the subscribe link and you will be directed to Subscribe page.
  5. Create subscription with following details. Once you are done click the Subscribe button.
  6. Now subscription to the specific topic is done. Now we can send events to CEP. 
  7. From another terminal switch to <CEP_HOME>/samples/producers/twitter-feed/ and run ant from there. This will build and run the wso2Event producer which will send some twitter feed 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

  8. From another terminal switch to <CEP_HOME>/samples/producers/stock-quote/ and run ant from there. This will build and run the jms producer which will send some sample stock quotes information to the CEP server. From this terminal, you will be able to view the details of the events sent. Below is the sample screen shot when sending events.

  9. Below is the console output in the CEP server when events are received after processing. 

  10. fdf

  • No labels