Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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.

...

  1. 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
    languagehtml/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
    languagehtml/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:in location 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 as conf:<resource path>. Similarly, if the BAM server profile is stored in the Governance Registry, it can be referred to as gov:<resource path>.

  2. Create the BAM server profile.
    BAM server profile is an XML file with the following structure:

    Code Block
    languagehtml/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
    languagehtml/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
    languagehtml/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 the type 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 standard From 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
    languagehtml/xml
    <ServerProfile xmlns="http://wso2.org/bam/2.0" name="BAMServerProfile">
    	<Connection enableLoadBalancing="false" url="tcp://127.0.0.1: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"/>

...

To setup the sample:

  1. Start BAM without a port offset.Configure a port offset of 10 for AS.
  2. Deploy the SalesData.aar file on app server.
  3. 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.
  4. Configure the bam publisher extension in the bps.xml file.
  5. Configure a port offset of 5 in carbon.xml for BPS.
  6. Upload KPIProcess.zip BPEL process to BPS.
  7. Now click on the services list and try the KPISampleProcess request.

    Code Block
    languagehtml/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>
  8. Send a few request to the BPS process. It would publish this data and the fault data received from salesdata service to BAM.
  9. Commence Configuring KPI Monitoring.
    1. Log into BAM,
    2. Install KPI_Phone_Retail_Store toolbox.
    3. 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.
  10. Conduct Fault Monitoring. In order to monitor the fault information, do the following: 
    1. An additional hive script should be added to BAM in the analytics section and select Add
    2. Copy and paste the hive script from phone_retail_sale_post_error_script to the text area and save the script.
    3. Execute the script. It generates the fault Summary table which contains the processed fault information.
  11. Generate the visualiser gadgetthe visualizer gadget
    1. 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.
    2. Specify the path according to your setup.
    3. The driver class name is org.h2.Driver.
    4. The username and password is wso2carbon.
    5. Click Next.
    6. Specify the SQL statement.
    7. Select faultCode and faultCount from faultSummaryYou can view the result set from preview SQL results section.
  12. 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.
  13. Click the Add Gadget tab and add the gadget to the portal by pasting the gadget URL obtained from the Gadget Gen Tool.
  14. Now it should show the graph that was constructed with the Gadget Gen Tool.
  15. The constructed sample gadget processfault.xml is also uploaded.