To Run the Cassandra Connector Demo

You can use this demo to do the following things:

  • Create a new keyspace and use the keyspace for other operations.

  • Drop a keyspace and delete its data.

  • Create a table in a specified keyspace or the keyspace you configured in the connection parameters.

  • Drop a table from the keyspace.

  • Get the names of tables from a keyspace.

  • Alter table operations: Add New Column, Remove Column, Rename Column, Change Column Type

  • Insert rows into the DEMO table.

  • Select all in the DEMO table.

  • Update the name or event column values in the DEMO table given the row Id.

  • Delete rows from the DEMO table given the row Id.

  • Delete values from the name and event columns of the DEMO table given row Ids.

  • Execute any valid CQL query, including parameters, such as SELECT * FROM DEMO WHERE id IN (?,?).

    1. Install and start Apache Cassandra.

    2. Create a keyspace if you don’t already have one. For example, create a keyspace named Excelsior.

    3. Install the Cassandra Connector in Studio and start Studio.

    4. Download the Cassandra Connector demo, demo.zip, from the Download section of this topic.

    5. Expand the downloaded file. In Studio, click Import > Anypoint Studio Project From External Location. Browse to and select /demo. Import the directory.

    6. Update the Apache Cassandra connection parameters in /src/main/app/mule-app.properties, using the pre-existing keyspace. For example:

    7. Save all.

    8. In CassandraDBDemo > Global Elements, select CassandraDB: Username/Password Connection, and click Edit.

    9. Click Test Connection, and assuming the connection succeeds, run the app.

      The following keyspace and table are created transparently in the Cassandra database:

      CREATE KEYSPACE demo_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}  AND durable_writes = true;
      CREATE TABLE demo_keyspace.demo_table (
          id int PRIMARY KEY,
          event text,
          name text

Go to http://localhost:8081/ and use the demo form to test drive the Cassandra connector.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Submit your feedback!
Share your thoughts to help us build the best documentation experience for you!
Take our latest survey!