This sample demonstrates how to publish incoming events to Apache Cassandra using the Cassandra event publisher of DAS. 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 DAS 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.csvfile and related configuration files so that the Event Simulator can be used to send events to the pre-configured event publisher.
- Creates an event publisher named
cassandrato send the received messages to a Cassandra cluster. This event publisher publishes 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:9160port. (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 DAS_KS;
Use keyspace: use DAS_KS admin 'admin';
Create column family: create column family CF_Transactions with comparator = 'UTF8Type' and caching='ALL';
- Log into the DAS Management Console. In the Tools tab, click Event Simulator to open the Event Simulator page. In the Event Stream Name field, select org.wso2.event.transaction.stream:1.0.0. In the Send multiple events section, click Play for the
event.csvfile to play the events.
You can see the events getting received by DAS by executing the command '
list CF_Transactions;' in Cassandra CLI.