This sample demonstrates how to publish incoming events to Apache Cassandra using the Cassandra event publisher of CEP. This sample does not do any processing on the incoming event. Use the pre-packaged Cassandra-CLI tool of Apache Cassandra, to verify if the messages are properly published.
Set up the prerequisites required for all samples.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0067. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Changes the default Axis2 repo from
- Creates an event stream named
- Loads the events.csv and related configuration files so that event simulator can be used to send events to the pre-configured event publisher.
- Creates an event publisher named 'cassandra' to send the received messages to a Cassandra cluster. This event publisher will publish events in Map (key,value pair) event format
Executing the sample
Setup a Apache Cassandra cluster. The sample is configured to send events to Cassandra cluster that is configured to listen on localhost:9160 port. (If the Cassandra cluster is running on a different node, please change the event publisher configuration as necessary). The Cassandra event publisher needs the following configurations to be valid in the Cassandra cluster.
Cluster Name: Test Cluster
Column Family: CF_Transactions (Comparator should be of type 'UTF8Type' or 'AsciiType')
Connection Username: admin
Connection Password: admin
Create a keyspace: create keyspace CEP_KS;
Use keyspace: use CEP_KS admin 'admin';
Create column family: create column family CF_Transactions with comparator = 'UTF8Type' and caching='ALL';
- Go to the management console of CEP and select org.wso2.event.transaction.stream:1.0.0, and select 'Play' to play the events.
You can see the events getting received by CEP by executing the command '
list CF_Transactions;' in Cassandra CLI.