Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This sample develops and visualizes couple of KPIs (Key Performance Indicator) for a phone retail store. The developed KPIs are  

  1. Quantity sold from each phone model -  The owner wants to know the performance of his product line. Total sales for each of the phone model is required.
  2. Number of orders received by each customer - The owner wants to know the no of orders received by each customer. 

...

  1. Start WSO2 BAM server with default settings.
  2. Go to 'WSO2_BAM_HOME/samples/kpi-definition/' directory
  3. Type 'ant' with in the directory from the console(This publishes the events to BAM)

    Note that you can give custom values for parameters for Data receiver URL, user name and password. Default values of them are as follows.

    ParameterDefault Value
    URLtcp://localhost:7611
    User Nameadmin
    Passwordadmin

    Now lets see how new values can be given as parameters 

    ParameterNew Value
    URLtcp://localhost:7612
    User Nameuser
    Passwordpass123

     Command with new values : ant  -Durl=tcp://localhost:7612 -Dusername=user -Dpassword=pass123

    Published event format (Stream definition)

    Code Block
    {
     "name" : "org.wso2.bam.phone.retail.store.kpi",
     "version" : "1.0.0",
     "nickName" : "Phone_Retail_Shop",
     "description" : "Phone Sales",
     "metaData" : [
            { "name" : "clientType",
              "type" : "STRING"
            } ],
     "payloadData" : [
            { "name" : "brand",
              "type" : "STRING"
            },
            { "name" : "quantity",
              "type" : "INT"        },
           { "name" : "total",
             "type" : "INT"       },
           { "name" : "user",
             "type" : "STRING"
           }] 
    }

    Sample

...

  1. data

    Code Block
    Event{
       streamId = 'org.wso2.bam.phone.retail.store.kpi-1.0.0-97c75175-776d-4732-aa21-1b901c15778f',
       timeStamp = 1343723606667,
       metaData = [external],
       correlationData = null,
       payloadData = [Nokia, 2, 140000, Harry] 
    } 

...

  1. Go to management console and login

...

  1. .

  2. Click    Main       and then click Add    in the    BAM Toolbox    menu.

  3. Select Phone Retail Store Toolbox

...

  1. , and click

...

  1. Install

...

...

  1. add a BAM ToolboxImage Added

...

  1. Click   

...

  1. Main   and then click    List    in the    BAM Toolbox

...

  1.   menu, to view the list of all installed toolboxes.

    list of BAM toolboxesImage Modified

...

  1.   Wait for some time, until script complete the first run after publishing the data. (Script will run in each minute)

...

  1. .   If hive job is successful you will see the following message on BAM console. 

    Ended Job = job_local_0001
    Execution completed successfully
    Mapred Local Task Succeeded . Convert the Join into MapJoin
    OK

...

  1. Click on Main -> Gadgets -> View portal to see the populated gadgets on the summarized data.

...

  1. Phone models sales summary
    Image Modified

    Sales summary by

...

  1. customers

...

  1. Image Added

Warning
iconfalse

The Hive script associated with the default KPI Monitoring sample has Cassandra port set as 9160. If you change the port offset, you should manually change the Cassandra port as well by following these steps:

  1. After installing the tool box, log in to the management console, select List sub menu under Analytics menu. This will open the Available Scripts window.
  2. Set "cassandra.port" = "9161" in the phone_retail_store_script and Save.