...
Business process data can be monitored with MAB2BAM2. In order to specify which configuration and data is to be monitored, BPS uses a configuration file called BAMProfile. This file is included within the BPEL package.
...
Configure the deployment descriptor.
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 BAM server profile is specified as follows:Code Block language html/xml <bamServerProfiles> <profile name="BAMServerProfile" location="file:BAMServerProfile.xml"/> </bamServerProfiles>
The
<bamServerProfiles>
element should come under the process element in deployment descriptor (deploy.xml). The following is an example of a deployment descriptor.Code Block language html/xml <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:SalesData="http://www.samples.wso2.org/bps/SalesData/" xmlns:samples.bps.wso2.org="http://samples.bps.wso2.org"> <process name="samples.bps.wso2.org:KPISampleProcess"> <active>true</active> <retired>false</retired> <process-events generate="all"/> <provide partnerLink="client"> <service name="samples.bps.wso2.org:KPISampleProcess" port="KPISampleProcessPort"/> </provide> <bamServerProfiles> <profile name="BAMServerProfile" location="file:BAMServerProfile.xml"/> </bamServerProfiles> </process> </deploy>
The ‘file:
‘ inlocation
is used to specify a file path. Similarly, the BAM server profile can be kept in the WSO2 registry as well. If the BAM server profile file is stored in configuration registry, it can be referred to asconf:<resource path>
. Similarly, if the BAM server profile is stored in the Governance Registry, it can be referred to asgov:<resource path>
.Create the BAM server profile.
BAM server profile is an XML file with the following structure:Code Block language html/xml <ServerProfile name=””> <Connection/> <Credential/> <Streams> <Stream/> ... ... <Stream/> </Streams> </ServerProfile>
BAM Server Profile Elements
The connection element is used to describe the BAM2 server information. Credential element describes the authentication info to authenticate to the BAM2 server. Under the<Streams>
element, many BAM streams can be defined. The following is the structure for a BAM stream definition:Code Block language html/xml <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>
A BAM2
<Stream>
definition should have the properties, ‘name
’, ‘version
’, ‘nickName
’ and ‘description
’. Under the<Stream>
element, each of the data items published to BAM is specified using the<Data>
element.Code Block language html/xml <Data“><Data> <key name=”” type=”payload | meta | correlation”> <From variable=”quantity”/> </key> <Data>
The
name
attribute of the<key>
element describes the key used by BAM to identify the given data item and thetype
attribute describes the type of data item. BAM2 has three types of data. They are meta data, payload data and correlation data. This can be specified using the type attribute. The standardFrom
syntax from BPEL is used to select the value of each key. When selecting a variable to be published to BAM, 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 a BAMServer Profile:Code Block language html/xml <ServerProfile xmlns="http://wso2.org/bam/2.0" name="BAMServerProfile"> <Connection secureenableLoadBalancing="false" ipurl="tcp://127.0.0.1" authPort="7711" receiverPort=":7611"/> <Credential userName="admin" password="kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg="/> <!-- KeyStore location="<BAM_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>
Set enableLoadBalancing to "true" with a comma separated urls to publish in multiple receiver nodes.
Receiver URL= tcp://<BAM Receiver -1>:<port>,tcp://<BAM Receiver -2>:<port>,tcp://<BAM Receiver -3>:<port>
eg: <Connection enableLoadBalancing="true" url="tcp://127.0.0.1:7611,tcp://127.0.0.1:7613"/>
Step 3: Run the BPEL Process and publish data to BAM
Anchor | ||||
---|---|---|---|---|
|
...
- Start BAM without a port offset.
- Configure a port offset of 10 for AS.
- Deploy the SalesData.aar file on app server.
- Download and unzip BPS from http://people.wso2.com/~nandika/insqp/bps_bam/.Copy the bps.xml file to the
repository/conf
directory of bps. - Configure the bam publisher extension in the bps.xml file.
- Configure a port offset of 5 in carbon.xml for BPS.
- Upload KPIProcess.zip BPEL process to BPS.
Now click on the services list and try the KPISampleProcess request.
Code Block language html/xml <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>
- Send a few request to the BPS process. It would publish this data and the fault data received from salesdata service to BAM.
- Commence Configuring KPI Monitoring.
- Log into BAM,
- Install KPI_Phone_Retail_Store toolbox.
- The hive script will be executed in three minute intervals. Hence after some time, you can visit the dashboard to see the visualizations generated based on data sent to the BPEL process.
- Conduct Fault Monitoring. In order to monitor the fault information, do the following:
- An additional hive script should be added to BAM in the analytics section and select Add.
- Copy and paste the hive script from phone_retail_sale_post_error_script to the text area and save the script.
- Execute the script. It generates the fault Summary table which contains the processed fault information.
- Generate the visualiser gadgetthe visualizer gadget.
- Go to the Tools menu and select Gadget Gen Tool and configure the data source.
The URL to be used is jdbc:h2:/home/nandika/insqp/bpssetup/wso2bam-2.0.0/<BAM_HOME>/repository/database/samples/WSO2CARBON_DB;
configure <BAM_HOME> according the directory where your bam is located. - Specify the path according to your setup.
- The driver class name is org.h2.Driver.
- The username and password is wso2carbon.
- Click Next.
- Specify the SQL statement.
- Select faultCode and faultCount from faultSummary. You can view the result set from preview SQL results section.
- Go to the Tools menu and select Gadget Gen Tool and configure the data source.
- Now the gadget generator shows the UI elements. Select your options and configure the gadget. Fault Against is the fault code that can be configured with this gadget. Once the gadget is configured, copy the gadget URL.
- Click the Add Gadget tab and add the gadget to the portal by pasting the gadget URL obtained from the Gadget Gen Tool.
- Now it should show the graph that was constructed with the Gadget Gen Tool.
- The constructed sample gadget processfault.xml is also uploaded.