<mule xmlns:cassandradb="http://www.mulesoft.org/schema/mule/cassandradb"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/cassandradb
http://www.mulesoft.org/schema/mule/cassandradb/current/mule-cassandradb.xsd">
<!-- Your flows and configuration elements -->
</mule>
To Install and Configure the Cassandra Connector
The Cassandra connector is shared in Exchange. You install the Cassandra connector in Anypoint Studio.
-
Launch Anypoint Studio.
-
Click Open Exchange .
-
Find the connector, and install it using the wizard.
To Configure the Cassandra Connector Global Elements
-
Click Global Elements > Create.
-
In Choose Global Type, use the filter to locate and select CassandraDB: Username/Password Connection.
-
In Global Element Properties for Cassandra, configure the following parameters:
Parameter Description Name
Enter a name for the configuration so it can be referenced later by the
config-ref
parameter in the flow.Username
Enter a Cassandra user name if you enabled PasswordAuthenticator in the Cassandra yaml. If AllowAllAuthenticator is enabled, leave this value blank.
Password
Enter the password if you enabled PasswordAuthenticator; otherwise, leave this value blank.
Host
Enter a host name, or IP address, of a Cassandra node.
Port
Enter a port number. The default port is 9042.
Keyspace
Enter the Cassandra keyspace. A keyspace groups column families.
-
Optionally, click Pooling Profile. Configure any settings relevant to managing multiple connections using a connection pool.
-
Optionally, click Reconnection. Configure any settings relevant to reconnection strategies that Mule should execute if it loses its connection to Cassandra.
-
Save the global connector configurations.
To Configure a Connection to a Cassandra Cluster
-
Click Advanced Configuration.
-
In Cluster Name, enter the Cassandra cluster name.
-
In Protocol Version, enter the version of the native protocol supported by the driver:
-
V1 ("1.2.0")
-
V2 ("2.0.0")
-
V3 ("2.1.0")
-
V4 ("2.2.0")
-
-
In Max Schema Agreement Wait Seconds, enter the maximum time to wait for schema agreement before returning from a DDL query.
-
In Compression, select the compression to use for the transport:
-
NONE
-
SNAPPY
-
LZ4
-
-
In SSL, enable or disable the use of SSL for the cluster.
To Configure Cassandra Connector Properties in Studio
-
Drag the Cassandra connector from the Mule palette onto the canvas, then select it to open the Properties Editor console.
-
Configure these connector parameters:
-
Display Name
Enter a unique label for the connector in your application. Default = Cassandra DB
-
Connector Configuration
Connect to a global element linked to this connector. Global elements encapsulate reusable data about the connection to the target resource or service. Select the global Cassandra connector element that you just created.
-
Operation
Select the database operation to perform.
-
To Configure Cassandra Connector Properties in the XML Editor
-
Include the Cassandra namespaces in your Mule configuration file:
-
Create a global Cassandra configuration outside and above your flows. For example, in an app that defines parameters in mule-app.properties, enclose parameter keys in curly brackets:
<cassandradb:config name="CassandraDB" username="${username}" password="${password}" doc:name="CassandraDB" keyspace="${keyspace}" host="${host}" port="${port}" />
-
Build your application flow and add a Cassandra connector using one of the connector database operations:
<cassandradb:create-keyspace>
-
Creates a new keyspace.
<cassandradb:drop-keyspace>
-
Drops the entire keyspace.
<cassandradb:create-table>
-
Creates a table in a specific keyspace
<cassandradb:drop-table>
-
Drops an entire table from the specified keyspace
<cassandradb:get-table-names-from-keyspace>
-
Returns all the table names from the specified keyspace.
<cassandradb:execute-c-q-l-query>
-
Executes the raw input query provided.
<cassandradb:insert>
-
Executes the insert entity operation.
<cassandradb:update>
-
Executes the update entity operation.
<cassandradb:delete-columns-value>
-
Deletes values from an object specified by the where clause.
<cassandradb:delete-rows>
-
Deletes an entire record.
<cassandradb:select>
-
Executes a select query.
<cassandradb:change-column-type>
-
Changes the type of a column.
<cassandradb:add-new-column>
-
Adds a new column.
<cassandradb:drop-column>
-
Removes a column.
<cassandradb:rename-column>
-
Renames a column.