Wednesday, July 22, 2015

WSO2 BPS : Business process monitoring with WSO2 Analytics

Business process  information can be monitored using WSO2 Data Analytics Server (DAS). For this an event stream should be published to DAS. WSO2 BPS 3.5.0 supports publishing to DAS 3.0.0.

Publishing data to DAS from BPS requires following steps. They are explained using the KPI sample in WSO2 BPS samples.

  1. Configure DAS publishing extension.
  2. Implement a business process with the configurations to publish the data to DAS.
  3. Run the BPEL process and publish data to DAS.
  4. Monitor information via DAS.

Configure DAS publishing extension

Add the following extensionActivity to bps.xml, which is located in /repository/conf/directory.

Create the BPEL process to publish data to DAS


In order to specify the server configuration details, and monitoring data (Payload, Correlation and Meta), BPS uses an XML configuration file. This configuration file should specify the BPEL process in the deploy.xml file (deployment descriptor file for a BPEL package). The analytics server profile is specified using  element <analyticsServerProfiles>. Observe the analytics profile in the following deploy.xml. The ‘file:‘ in location is used to specify the file path to analytics server profile.
Let's create the analytics server profile. It takes the following xml structure.


The connection element is used to describe the Analytics server information. Credential element describes the authentication info to authenticate to the Analytics server. Under the element, many Analytics streams can be defined. The following is the structure for a Analytics stream definition.



A DAS definition should have the properties, ‘name’, ‘version’, ‘nickName’ and ‘description’. Under the <stream> element, each of the data items published to analytics server is specified using the child element <data>.
The name attribute of the 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.


Run the BPEL Process and publish data to Analytics server

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


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.



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.

Monitor information via DAS

KPI sample shipped with WSO2 BPS is a bpel process can submit event information to the Analytics server. Let's setup the sample.
  • Start DAS without a port offset.
  • Download and unzip BPS.
  • Configure the bps.xml file in the repository/conf directory of bps by adding the DAS publishing extension as mentioned in step 1.
  • Configure a port offset of 5 in carbon.xml.
  • Upload KPIProcess.zip BPEL process in /repository/samples/bpel to BPS.
  • Now click on the services list and send the KPISampleProcess request as mentioned below using tryit editor. Send few more requests.
  • 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’.
  • Log into DAS, click on the Streams under Manage tab to check the created stream definition.
  • Click edit under 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.
  • We need to persist the data received from  BPEL process in order to analyse them. Click on the ‘Next[Persist Event]’ button at the bottom.
  • Select whatever data you need to persist from here and click save stream. 
  • We need to add a event receiver to populate the table we created, with data received from BPEL process. Click on ‘Receivers’ under Manage tab. Click on ‘Add Event Receiver’. 
  • Fill the form with following information.
  1. Event Receiver Name :
  2. Adapter type : wso2event
  3. Event stream - org.wso2.bam.phone.retail.store.kpi:1.0.0
  4. Message format - wso2event
  • Submit the form to create new event receiver from bps.
  • Now we have setup the infrastructure to receive and analyse event information from BPS. Let’s create a dashboard to visualise the KPI data. Create a new Dashboard in DAS as instructed in Adding a Dashboard.
  • Now follow the instructions in  ‘Adding a gadget using the gadget generation wizard’ section in page Adding gadgets to a layout. Select ‘ORG_WSO2_BAM_PHONE_STORE_KPI’ as the datasource here. You can create different types of charts and use different data combinations here.
  • 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.


No comments:

Post a Comment