Versions Compared

Key

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

...

Code Block
languagexml
<Data“>
    <key name=”” type=”payload | meta | correlation”>
        <From variable=”quantity”/>
    </key>
<Data>

The name attribute of the key element describes the key used by analytics server to identify the given data item and the type attribute describes the type of data item. Analytics server has three types of data. They are meta data, payload data and correlation data. This can be specified using the type attribute. The standard From syntax from BPEL is used to select the value of each key. When selecting a variable to be published to DAS, it can be specified as <From variable=”quantity”/>. The variable name should be the same name used in the BPEL process. The following is a complete example of an AnalyticsServer Profile.

Code Block
languagexml
<ServerProfile xmlns="http://wso2.org/analytics/3.0" name="AnalyticsServerProfile">
    <Connection secure="false" ip="127.0.0.1" authPort="7711" receiverPort="7611"/>
    <Credential userName="admin" password="kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg="/>
    <!-- KeyStore
        location="<DAS_HOME>/repository/resources/security/client-truststore.jks"
        password="CpIZ4fbSj03GQyiNSVUJCbX/6UMJJbaTNOzPKtFlkC0="/-->
    <Streams>
        <Stream name="org.wso2.bam.phone.retail.store.kpi" version="1.0.0" nickName="Phone_Retail_Shop" description="Phone Sales">
            <Data>
                <Key name="brand" type="payload">
                    <From variable="brand"/>
                </Key>
                <Key name="quantity" type="payload">
                    <From variable="quantity"/>
                </Key>
                <Key name="user" type="payload">
                    <From variable="user"/>
                </Key>
                <Key name="total" type="payload">
                    <From variable="total"/>
                </Key>
            </Data>
        </Stream>
    </Streams>
</ServerProfile>

Run the BPEL Process and publish data to Analytics server

When developing the BPEL process, the following information must be included in the BPEL process for DAS publishing to work. Under the process element in the BPEL script, define the DAS publishing extension.

Code Block
languagexml
<bpel:extensions>
    <bpel:extension namespace="http://wso2.org/bps/monitoring/publisher" mustUnderstand="yes"/> 
</bpel:extensions>

Also include the namespace found in http://wso2.org/bps/monitoring/publisher in the process declaration. Now, in the location where you want information published, include the following extension activity section.

Code Block
languagexml
<bpel:extensionActivity xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:bam="http://wso2.org/bps/monitoring/publisher">
    <bam:publish analyticsServerProfile="AnalyticsServerProfile" streamName="org.wso2.bam.phone.retail.store.kpi" version="1.0.0" nickName="kpistore"/>
</bpel:extensionActivity>

The publish element describes the name given to the Analytics server profile and the corresponding stream definition to get the configuration data. If all configurations are done correctly, when you run the BPEL process, the data is published to Analytics server.

Monitoring information via DAS

The KPI Monitoring Sample with BPS submits event information to the Analytics server.

The following are the required products.

  • WSO2 BPS
  • WSO2 DAS

To setup the sample, do the following.

  1. Start DAS without a port offset.
  2. Download and unzip BPS.
  3. Configure the bps.xml file in the <BPS_HOME>/repository/conf directory by adding the DAS publishing extension mentioned in Configure the DAS publishing extension.
  4. Configure a port offset of 5 in the <BPS_HOME>/repository/conf/carbon.xml file.
  5. Upload the KPISample.zip BPEL process found inside the <BPS_HOME>/repository/samples/bpel directory to BPS.
  6. Click on the services list and send a KPISampleProcess request as mentioned below using tryit editor.

    Code Block
    languagexml
    <p:KPISampleProcessRequest xmlns:p="http://samples.bps.wso2.org">
        <brand xmlns="http://samples.bps.wso2.org">samsung</brand>
        <quantity xmlns="http://samples.bps.wso2.org">1</quantity>
        <total xmlns="http://samples.bps.wso2.org">500</total>
        <user xmlns="http://samples.bps.wso2.org">test</user>
    </p:KPISampleProcessRequest>

     

  7. Send a few request to the BPS process. It would publish this data to DAS and deploy a new stream definition with id ‘org.wso2.bam.phone.retail.store.kpi:1.0.0’.

  8. Commence KPI Monitoring. To do this, do the following.

    1. Log into DAS. 
    2. Click on Streams under the Manage tab to check the created stream definition.
      Image Added 
    3. Click Edit under the Actions column. This will show all the information of the event stream. Do not change anything here for this sample. It will change the stream.

    4. You need to persist the data received from the BPEL process in order to analyse it. Click on the ‘Next[Persist Event]’ button at the bottom.

    5. Select whatever data you need to persist from here and click Save Event Stream.
      Image Added 

  9. You must add an event receiver to populate the table you created with data received from the BPEL process. To do this, do the following.

    1. Click on Receivers under the Manage tab. 

    2. Click on Add Event Receiver. The following form appears.
      Image Added

    3. Fill the form with following information.

      • Event Receiver Name: <proper name>

      • Adapter type: wso2event

      • Event stream: org.wso2.bam.phone.retail.store.kpi:1.0.0

      • Message format: wso2event

    4. Submit the form to create new event receiver from BPS.

  10. Now you have setup the infrastructure to receive and analyse event information from BPS. Create a dashboard to visualize the KPI data.

    1. Create a new Dashboard in DAS as instructed in Adding a Dashboard.

    2. Follow the instructions in the ‘Adding a gadget using the gadget generation wizard’ section in the Adding Gadgets to a Dashboard topic. Select ‘ORG_WSO2_BAM_PHONE_STORE_KPI’ as the datasource here. You can create different types of charts and use different data combinations here.
      Image Added

    3. Add the new gadget to your dashboard.

Now you can visualise the event information using the Analytics Dashboard. Try sending more requests to the BPEL process and note the changes in charts.