2014/08/07
7 Aug, 2014

[Tutorial] A Step-by-Step Guide on How to Run CEP Fleet Management Samples

  • Awanthika Senarath
  • Software Engineer - WSO2
Archived Content
This content is provided for historical perspective only, and may not reflect current conditions. Please refer to the WSO2 analytics page for more up-to-date product information and resources.

Co-author of this tutorial

Yassasri Ratnayake

Table of contents

  • Prerequisites
  • Configuring the CEP to run the samples
  • Running the samples
    • Sample 01
    • Sample 02
    • Sample 03

Prerequisites


Configuring the CEP to run the samples

Unzip the content and follow the below steps;

  1. Copy the three sample folders 1002, 1003 and 1004 to CEP_HOME/samples/artifacts
  2. Copy the GPS_Stream_Consumer in the consumer folder to CEP_HOME/samples/consumers
  3. Copy the DataAgent in the producer folder to CEP_HOME/samples/producers
  4. Copy the two siddhi extension jars in the customextensions folder to CEP_HOME/repository/components/lib and also update the /CEP_HOME/repository/conf/siddhi/siddhi.extension file by adding the following content;
    customtransformer.WithinBufferTransformer
    customextension.GeoProximity
  5. Copy the Jars in the lib folder to the CEP_HOME/samples/lib directory

Now the CEP is configured to run the CEP Fleet Management samples.


Running the samples

Sample 01: Speed Alert

This sample will demonstrate a speed alert scenario. If a device exceeds a predefined speed threshold an alert will be generated and it will be shown in the console as shown below;

Figure 1.0

Follow the below steps to run the sample;

  • Start the CEP with the following command to run it with sample 1002

    ./wso2cep-samples.sh -sn 1002

    This demonstrates the high speed alarm triggering in fleet management (make sure your ActiveMQ is running in the default port)
  • Move to the CEP_HOME/samples/consumers/GPS_Stream_Consumer and run ant.
    This starts the message consumer for CEP which pulls the data from activemq and pushes it to the socket server.
  • Open the URL https://localhost:9763/CEP_DeviceTracking_Sample/

On the ‘Admin Panel’ go to ‘Enable Alerts’ and enable the ‘Speed Alert’ as shown in Figure 1.1

Figure 1.1

Note: If the ‘Focus on Device’ option is enabled the focus will be maintained on a specific device which will demonstrate the scenario. Deselect this option to freely move along the MAP console.

  • Run the producer to generate the data stream for the CEP. Move to CEP_HOME/samples/producers/DataAgent and run ant

Ensure that ActiveMQJMSAdaptor is activated in the CEP before running the producer.

Go to your browser and tick the relevant options and observe the different vehicles moving. When a vehicle’s speed exceeds 5 km/h the speed alarm will be triggered. This is shown in Figure 1.0.


Sample 02: Stationery Alert

This sample will demonstrate a stationary alert scenario. If a device stays within a predefined buffer-zone stationed for a predefined period of time an alert will be generated and it will be displayed in the console as shown below;

Figure 2.0

  • Start the CEP with the following command to run it with sample 1003

    ./wso2cep-samples.sh -sn 1003

    This demonstrates the stationary alarm triggering in fleet management (make sure your ActiveMQ is running in the default port)
  • Move to the CEP_HOME/samples/consumers/GPS_Stream_Consumer and run ant
  • Open the URL https://localhost:9763/CEP_DeviceTracking_Sample/

On the ‘Admin Panel’ go to ‘Enable Alerts’ and enable the ‘Stationary Alert’ as shown in Figure 2.1

Figure 2.1

Note: If the ‘Focus on Device’ option is enabled the focus will be maintained on a specific device which will demonstrate the scenario. Deselect this option to freely move along the MAP console.

  • Run the producer to generate the data stream for the CEP. Move to CEP_HOME/samples/producers/DataAgent and run ant

Ensure that ActiveMQJMSAdaptor is activated in CEP before running the producer.

Go to your browser and tick the relevant options and observe the different vehicles moving. When a vehicle reached the predefined buffer point the stationary alarm will be triggered.This is because the time period for which the stationary condition is checked is set to 0.01 seconds. It is possible to increase the time period and observe that the alarm is triggered only if the device remains stationary for that period. Changes need to be done in the execution plan.

Sample 03 : Proximity Alert

This sample will demonstrate a proximity alert scenario. If two devices move in close proximity for more than a predefined time period an alert will be generated as shown below;

Figure 3.0

  • Start the CEP with the following command to run it with sample 1004

    ./wso2cep-samples.sh -sn 1004e

    This demonstrates the proximity alarm triggering in fleet management (make sure your ActiveMQ is running in the default port)
  • Move to the CEP_HOME/samples/consumers/GPS_Stream_Consumer and run ant. This starts the message consumer for CEP which would pull the data from activemq and push it to the socket server
  • Open the URL https://localhost:9763/CEP_DeviceTracking_Sample/

On the ‘Admin Panel’ and go to ‘Enable Alerts’ and enable the ‘Proximity Alert’ as shown below;

Figure 3.1

Note: If the ‘Focus on Device’ option is enabled the focus will be maintained on a specific device which will demonstrate the scenario, Untick this option to freely move along the MAP console.

  • Run the producer to generate the data stream for the CEP. Move to CEP_HOME/samples/producers/DataAgent and run ant
    Ensure that ActiveMQJMSAdaptor is activated in the CEP before running the producer.

Go to your browser and tick the relevant options and observe the different vehicles moving and triggering the proximity alarm when any two devices move in close proximity than 20 meters for over 4 seconds.

Note: All the samples are configured and developed to run on default CEP configurations when started on localhost and on the default port. If the address endpoints need to be changed they have to be done in a code level.


UI Guide

Figure 4.0

  1. Display Settings
  2. Enable Alerts
  3. Advance Options
  4. Guides
  5. Map Options
  6. Device Detail Console
  7. Connected Device Output Console
  8. Stream Output Console
  9. Alerted Vehicle Output console
  10. Map Console

To view a more detailed guide on the UI go the sample guide menu in the UI console and open the UI Guide as shown below;

Figure 4.1

 

About Author

  • Awanthika Senarath
  • Software Engineer
  • WSO2