Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.
This documentation is for WSO2 Data Services Server version 3.5.1. For the latest documentation, see the documentation for WSO2 Enterprise Integrator.
||
Skip to end of metadata
Go to start of metadata

This sample demonstrates the use of the Cassandra data source functionality in WSO2 Data Services Server (WSO2 DSS), which you can use to connect to a Cassandra cluster.

Prerequisites

A Cassandra server of version 1.2.x, 2.0 or 3.0 should be already running in the default port. Cassandra version 3.0 is recommended. For instructions, go to Apache Cassandra Documentation.

Building the sample

The sample named CassandraSample is shipped with WSO2 DSS, by default. This .dbs file is stored in the <DSS_HOME>/samples/dbs/cassandra/ directory. Follow the steps given below.

  1. Before you upload the sample data service, be sure to start the Cassandra server.
  2. Follow the instructions in Uploading a Created Data to deploy the sample file  (CassandraSample.dbs) in WSO2 DSS. Click Services → List on the navigator. The sample should be listed on the services' dashboard.

For more information on using Cassandra as a datasource, see this tutorial.

Running the sample

The sample service can be run using the TryIt tool, which is bundled with the WSO2 DSSFollow the steps below to demonstrate this functionality using the TryIt tool:

  1. Log in to the management console of your server and click List under Services in the navigator. The CassandraSample will be listed here.
  2. Click Try this service to open the TryIt tool. 
  3. The service contains the following operations: 
    • "createKS": This creates the Cassandra keyspace required for the sample. This must be called once before running other operations.
    • "createTable": This creates a Cassandra CQL3 table required for the sample. This must be called once after "createKS" is called.
    • "addUser": This operation takes in user details and adds it to Cassandra. Here "ID" is the primary key and it takes in an UUID as the value.
    • "addUser_batch_req": This is the corresponding batch request of "addUser", where it takes in a batch of "addUser" data entries and adds it as a single batch operation.
    • "getUserById": This operation returns the user information when you provide the ID of a specific user.
    • "getUsers": This operation returns information of all the users stored in the Cassandra store.
  • No labels