Configuring WSO2 BAM 2.4.1 with external Apache Cassandra 2.x cluster

WSO2 Business Activity Monitor (BAM) writes incoming data(events) into Cassandra. Reason why Cassandra came into play is it’s higher write throughput, linear scalability and eventual consistency.
By default, BAM ships with an embedded Cassandra instance which starts and stops with BAM. But when running on a production environment, single Cassandra instance will not be capable of handling higher data load. So BAM can be configured to work with an external Cassandra cluster which is highly available and scalable.

Instructions for setting up a multi node Cassandra cluster can be found at [1].
WSO2 BAM 2.4.1 can be downloaded from [2]

Purpose of this post is to demonstrate how WSO2 BAM 2.4.1 instance can be configured to work with a cluster of three Apache Cassandra 2.x nodes.
Note: Same instructions applies when configuring BAM with Apache Cassandra 1.x

Let’s assume hostnames and ports of the Cassandra ring are as follows.
– on port 9160
– on port 9160
– on port 9160


Step 1: Edit <BAM installation folder>/repository/conf/etc/hector-config.xml

This file configures the nodes which belongs to Cassandra cluster/ring. Incoming event data will be written to these nodes.
Edit hector-config.xml to include the nodes of our Cassandra ring as follows.



   <AutoDiscovery disable="false" delay="1000"/>

Note: For BAM versions before 2.4.1, this configuration lies inside   <BAM installation folder>/repository/conf/etc/cassandra-component.xml

Step 2:  Edit <BAM installation folder>/repository/conf/datasources/bam-datasources.xml

This file configures the Cassandra datasources. Simply put, nodes where BAM reads data from Cassandra.


Make sure to put correct Cassandra credentials for <username> and <passwords>.

 <description>The datasource used for Cassandra data</description>
 <definition type="RDBMS">


Make sure to put correct Cassandra credentials for <username> and <passwords>. Most importantly set externalCassandra flag to true.

 <description>The datasource used for BAM utilities, such as message store etc..</description>
 <definition type="RDBMS">
 <property name="externalCassandra">true</property>

Note: For BAM versions before 2.4.1, these configurations can be found inside   <BAM installation folder>/repository/conf/datasources/master-datasources.xml

Step 3:  Edit <BAM installation folder>/repository/conf/advanced/streamdefn.xml

This file configures the replication factor and read/write consistency levels for data receivers when writing data to Cassandra.

Edit <ReplicationFactor>, <ReadConsistencyLevel> and <WriteConsistencyLevel> as follows.



That’s it. Now your BAM instance is all set to go. Once it receives data, they will be written into the external Cassandra ring.