This sample demonstrates how to setup WSO2 Business Activity Monitor (BAM) to collect and summarize runtime statistics from the WSO2 API Manager and generate bills for API consumers on usage.
- Java Development Kit/JRE version 1.6.* or 1.7.*.
- Download and install WSO2 BAM using the instructions given in BAM Installation Guide: http://docs.wso2.org/business-activity-monitor/Installation+Guide.
Building and Running the Sample
1. Open <BAM_HOME>/repository/conf/carbon.xml file where <BAM_HOME> is the BAM binary distribution folder that was downloaded as a prerequisite above. Change the carbon.xml file's port offset to 1. This is done to avoid any port conflicts of running two WSO2 Carbon instances in the same machine.
2. Copy the API_Manager_Analytics.tbox in <APIM_HOME/samples/Billing folder to <BAM_HOME>/repository/deployment/server/bam-toolbox folder. Create the bam-toolbox directory if it already doesn't exist.
3. Add the following code segment to <BAM_HOME>/repository/conf/datasources/master-datasources.xml file.
4. Start WSO2 BAM server by running wso2server.bat (on Windows) and wso2server.sh (on Linux).
Configuring API Manager
5. To enable API statistics collection, configure the following properties in <APIM_HOME>/repository/conf/api-manager.xml file.
6. Ensure that
<APIUsageTracking> element in api-manager.xml file is un-commented and the value is the same as JNDI config name in master-datasources.xml file.
7. Configure the data source definition in <APIM_HOME>/repository/conf/datasources/master-datasources.xml file.
8. Copy <APIM_HOME>/samples/Billing/billing-conf.xml file into <APIM_HOME>/repository/conf folder.
View Billing Information
Once the above configurations are done, log in to API Store Web application (
//<YourHostName>:9443/store). You will see the menu items required for API Monetization are now visible in the Store.