Thursday, September 26, 2013

Using PostgreSQL with WSO2 BAM

WSO2 Business Activity Monitor (BAM) can be used to address monitoring requirements in business activities and processes. It supports aggregating, analyzing and presenting information about business activities.

WSO2 BAM architecture is designed to handle these steps through its different modules.  Data Receivers in WSO2 BAM receive data and store them in a Cassandra data store. The Analyzer Engine will run analytics according to defined Hive queries and stores the result in a RDBMS data store. Finally the analyzed data will be fetched from the data store and shown in dashboards or reports.

This post will show how to integrate PostgreSQL into WSO2 BAM, which could be used to store analyzed data.


Step 1:
Install PostgreSQL and create a database named "wso2bam_postgresql".
In Ubuntu, 
sudo apt-get install postgresql

Then log into PostgreSQL through psql command
sudo -u postgres psql

Then enter the following command to create the database.
create database wso2bam_postgresql;

You can view the existing databases using \l command

Step 2:
Download PostgreSQL JDBC driver and place it in [BAM_HOME]/repository/components/lib/ folder.

Step 3:
Define the PostgreSQL data source by adding the following configuration to
[BAM_HOME]/repository/conf/datasources/master-datasources.xml file.


<datasource>
   <name>WSO2BAM_POSTGRESQL</name>
   <description>The datasource used for analyzer data</description>
   div
   <definition type="RDBMS">
      <configuration>
         <url>jdbc:postgresql://localhost:5432/wso2bam_postgresql</url>
         <defaultautocommit>false</defaultautocommit>
         <username>postgres</username>
         <password>pwd</password>
         <driverClassName>org.postgresql.Driver</driverClassName>
         <maxActive>50</maxActive>
         <maxWait>60000</maxWait>
         <testOnBorrow>true</testOnBorrow>
         <validationQuery>SELECT 1</validationQuery>
         <validationInterval>30000</validationInterval>
      </configuration>
   </definition>
</datasource>
 
Step 4:
Start the BAM server and test the data source connection by going to Configure > Data Sources in the Management Console and select the added data source.



Then click on "Test Connection" button and it should give a message saying "Connection is healthy".



Now you can use WSO2BAM_POSTGRESQL datasource from BAM.


0 comments:

Post a Comment