Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Table of Contents

Introduction

This sample demonstrates how to set up an execution plan with a simple filter. It checks for delayed flight arrival and add the specific flights and adds related flight event events to the stream called delayedFlightStream. named delayedFlightStream. This sample uses jms queues for processing.

The query used in this sample is as follows:

Code Block
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.

...

Prerequisites

  1. See Prerequisites in CEP Samples Setup page.
  2. Copy the ActiveMQ JMS related JARs referred in JMS Transport to <CEP_HOME>/repository/components/lib directory

...

  1. .

...

...

  1. Copy the following JARs from ActiveMQ distribution directory to <CEP_HOME>/samples/lib directory

...

  1. .
    • <ActiveMQ_HOME>/activemq-all-5.7.0.jar

    • <ActiveMQ_HOME>/lib/ geronimo-jms_1.1_spec-1.1.1.jar

...

  1. Also copy apache axiom.jar

...

  1. to

...

  1. <CEP_HOME>/samples/lib directory

...

  1. to send

...

  1. XML event types

    Note

    Start the ActiveMQ server before the CEP server starts.

Building the

...

sample

Start the WSO2 CEP server with the sample

...

configuration numbered 0103. For instructions, see Starting sample CEP configurations. This sample configuration does the following:

  • Creates <CEP_HOME>/repository/conf

...

  • /stream-manager-config.xml file, which is used to create the stream definitions

...

  • for the sample.

...

  • Points the default Axis2 repo

...

  • to

...

  • <CEP_HOME>/sample/artifacts/0103 (by default, the Axis2 repo is <CEP_HOME>/repository/deployment/server)

...

  • .

Executing the

...

sample

  1. Open another terminal and switch a new terminal, go to <CEP_HOME>/samples/consumers/log-service jms 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.

    Info

    ant -DsampleNo=0102

    Image Removed

  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.
    Image Removed
  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.
    Image Removed
  5. Create subscription with following details. Once you are done click the Subscribe button.
    Image Removed
  6. Now subscription to the specific topic is done. Now we can send events to CEP. 
  7. From another terminal switch command below.

    Code Block
    ant queueConsumer -Dqueue=DelayedFlightStats (Since we are sending events from CEP to a topic called DelayedFlightStats)

    It builds the sample jms consumer and executes it.

    Info

    Do not close this terminal. It is required to keep the server running and receiving events.

  8. Open another terminal, go to <CEP_HOME>/samples/producers/twitterflight-feed/ stats and run ant from there. This will build and run the wso2Event producer which will send some twitter feed data

    It builds and runs the jms producer, which sends flight stats to the CEP server.

  9. From this terminal, you will be able to view see the details of the events sent.

    Info
    titleNote

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

    For example : ant -Dqueue=FlightStats

    Image Removed

  10. 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.
    Image Removed

  11. Below is the console output in the CEP server when events are received after processing. Image Removed

  12. fdfImage Added

  13. Also, see the output events received from the CEP via the terminal opened in step 1. For example,Image Added