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 15 Next »

This sample demonstrates the real-time analytics features of WSO2 BAM, by using the integrated WSO2 CEP features.

Creating an event stream

Follow the steps below to create a new event stream.

creating an event stream

  1. Log in to the WSO2 BAM management console.
  2. Click Main, and then click Event Streams.
  3. Click Add Event Stream.
  4. Enter org.wso2.sample.rt.traffic for  Event Stream Name , and enter 1.0.0 for  Event Stream Version.
  5. Enter the following values for Payload Data Attributes under  Stream Attributes and click Add.
    • Attribute Name   entry
    • Attribute Type  string
  6. Click  Add Event Stream.
  7. Select Default WSO2Event Builder in the message that pops up as shown in the below diagram, and click OK.
    define default WSO2 event builder

Creating HTTP event output adaptor

Follow the steps below to create a HTTP event output adaptor.

create HTTP output event adaptor

  1. In the BAM management console click Configure, and then click Output Event Adaptors.
  2. Click Add Output Event Adaptor.
  3. Enter HTTP for Event Adaptor Name and select http for Event Adaptor Type.
  4. Click Add Event Adaptor.

Creating the execution plan

Follow the steps below to create a new execution plan.

create execution plan

  1. In the BAM management console click Main, and then click Execution Plans.
  2. Click Add Execution Plan.
  3. Enter rt_traffic_plan for Execution Plan Name.
  4. Under Import Stream select  org.wso2.sample.rt.traffic for Import Stream, and enter traffic for As.
  5. Click Import.
  6. Enter the following query expression in the provided space:
    from traffic#window.time(1 sec) select count(entry) as entryCount insert into traffic_out;
  7. Under Export Stream, enter traffic_out for Value of.
  8. Select Create Stream Definition for StreamId

    Creating the steam definition

    define event stream
  9. Enter traffic_out for Event Stream Name, and 1.0.0 for Event Stream Version.
  10. Click Add Event Stream.
  11. Select Custom Event Formatter from the message that pops up, and click OK.

    create custom event formatter

    Creating the Custom Event Formatter

  12. Enter the following values to create a new event formatter:
    • Event Formatter Namert_traffic_formatter
    • Stream Attributes entryCount long
    • Output Event Adaptor Name - HTTP
    • URL - https://localhost:9443/message_store?type=RT_SAMPLE_STATS
    • Username - admin
    • Password - admin
    • Output Event Typetext
  13. Click Add Event Formatter.
  14. Click Add Execution Plan and select Yes in the message, which pops up.

Installing the toolbox

Follow the steps below to install the Realtime Traffic Monitoring Toolbox.

  1. In the BAM management console click  Main,  and then click Add under BAM Toolbox menu .
  2. Select  Realtime Traffic Monitoring Toolbox from the list under Basic ToolBox.
  3. Click Install.

Publishing data to WSO2 BAM

Follow the steps below to run the sample to execute a data publisher, and send data to WSO2 BAM.

  1. Navigate to <BAM_HOME>/samples/rt-traffic/ directory using the command line console and execute the following command: ant

    This will start executing a data publisher, which will publish data continuously at a random rate to WSO2 BAM.
  2.   Navigate to https://<HOST>:9443/bamdashboards/rt_traffic/stats.jag using your web browser.  

    <HOST> must be the exact host, on which the server is started up. Replacing it with localhost may not work, because of browser cross domain limitations.

    You will see a line graph being updated in real-time to show the frequency of the messages being published at that time as follows.

  • No labels