Connecting to an external Cassandra database through a Database Table data set
Connect Pega Platform to an external Cassandra cluster through a dedicated Database Table data set so that you can use custom tables that you store in Cassandra in data flows to read and write data. You can access your custom data model by mapping the model to a Pega Platform class.
To set up the connection, define a database instance that points to your Cassandra cluster and create a class mapped to the Cassandra cluster. Define a table in the Cassandra class and map it to the Cassandra database instance. Finally, define a Database Table data set in the Cassandra class.
Creating a Cassandra database instance
Start the configuration of the connection to an external Cassandra by creating a Cassandra database instance.
- In the header of Dev Studio, click .
- On the Create Database form, enter a short description
and a name for the database.The database name is case-sensitive.
- Click Create and open.
- On the Edit Database form, in the Integration
system field, enter: PegaThis parameter indicates the integration system that is associated with this database. The value that you enter is for informational purposes only, and does not affect the behavior of the database instance. You can use this value to organize rules for integration connectors, data types, and sources for data pages.
- In the How to connect list, select Use Cassandra cluster configuration listed below.
- In the Cassandra Hostnames and Ports section, click
Add Host, and then enter a hostname or IP address and
port for a node in the Cassandra cluster.You can specify multiple hosts.
- In the Cassandra Cluster section, enter the keyspace, username, and password that you use to connect to the database.
- Test the database connection by clicking Test connection.
- Click Save.
Creating a class to map to Cassandra
After configuring a Cassandra database instance, define a class that is mapped to the Data-Admin-DB-Table Cassandra table.
- In the header of Dev Studio, click .
- On the Create Class form, in the Label field, enter a description of the class.
- In the Class Name field, enter the name of the class.
- In the Context section, select the application and ruleset for the class.
- Click Create and open.
- On the Edit Class form, in the Select class type list, select Concrete.
- In the Settings section, in the Created in version field, enter the version of the ruleset that you want to use for the class.
- In the Keys section, provide the Cassandra table partition
keys.The keys may be compounds with many values.
- In the Class inheritance section, in the Parent class (Directed) field, enter the name of the directed inheritance parent class.
- On the External mapping tab, define all columns that you want to read or save to Cassandra, and then map them to existing properties.
- Click Save.
Defining the Cassandra table
Create a Data-Admin-DB-Table instance to configure a Cassandra table and map the table to the class that you configured earlier. You can either search for an existing table by the class name or create a new table.
- In the header of Dev Studio, click .
- On the Create Database Table form, enter a short
description and the name of the Cassandra
class that you configured earlier.The name is case-sensitive.
- Click Create and open.
- On the Edit Database Table form, in the Database field, select the Cassandra database that you configured earlier.
- In the Table name field, enter the name of an existing table.
- Test the database connection by clicking Test connectivity.
- Click Save.
Creating a Cassandra Database Table data set
Complete the external Cassandra connection configuration by creating a dedicated Cassandra data set that you can later use to access your external data in Pega Platform.
- In the header of Dev Studio, click .
- On the Create Data Set form, in the Label field, enter a name for the data set.
- In the Type list, select Database table.
- In the Context section, configure the context settings for
the data set:
- In the list of applications and in the Add to ruleset field, select the same application and ruleset as for the Cassandra database that you configured earlier.
- In the Apply to field, select the Cassandra class that you configured earlier.
- Click Create and open.
- On the Edit Data set form, in the Selectable
keys section, click Add key, and then
define the Cassandra table cluster keys.The form displays the database table details, such as the table name, the database type, and the partitioning keys. The details are retrieved automatically from the class definition.
- Click Save.
Previous topic Recommendations for choosing the partitioning key Next topic Creating an HBase data set record