WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

Introduction

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.

Prerequisites

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  <CEP_HOME>/repository/deployment/server to <CEP_HOME>/samples/cep/artifacts/0067.
  • Creates an event stream named org.wso2.event.transaction.stream:1.0.0.
  • 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

  1. 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
    • Keyspace: CEP_KS
    • Column Family: CF_Transactions (Comparator should be of type 'UTF8Type' or 'AsciiType')
    • Connection Username: admin
    • Connection Password: admin
    You can use the Cassandra CLI client that is packaged with Apache Cassandra to create the keyspace and column family as necessary. The following CLI commands have been tested with Apache Cassandra v1.2.19
    • 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';

    creating an event publisher

  2. Go to the management console of CEP and select org.wso2.event.transaction.stream:1.0.0, and select 'Play' to play the events.
  3. You can see the events getting received by CEP by executing the command 'list CF_Transactions;' in Cassandra CLI.

  • No labels