Creating a Kafka data set
You can create a Kafka data set in Pega Platform, and then associate it with a topic in a Kafka cluster. You can select an existing topic in the Kafka cluster or define a new topic when creating the data set.
Configure Kafka data sets to read and write data from and to Kafka topics, and use this data as a source of events, such as customer calls or messages. Your application can use these events as input for rules that process data in real time and trigger actions.
For example, when a customer who has a checking account with UPlus Bank accesses the bank's ATM, this event can initiate an associated action, such as displaying an offer for a new credit card on the ATM's screen. For more information, see Triggering a real-time event with the Event Stream service.
You can connect to an Apache Kafka cluster version 0.10.0.1 or later.
- In Dev Studio, click .
- Provide the data set label and identifier.
- From the Type list, select Kafka.
- Provide the ruleset, Applies to class, and ruleset version of the data set.
- Click Create and open.
- In the Connection section, perform one of the following
actions:
- Select a Kafka configuration instance in the Data-Admin-Kafka class.
- Create a Kafka configuration instance (for example, when no instances are present)
by clicking the Open icon.
For more information, see Creating a Kafka configuration instance.
- Check whether the Pega Platform is connected to the Kafka cluster by clicking Test connectivity.
- In the Topic section, perform one of the following
actions:
- Select Create new, and then enter the topic name to define a new topic in the Kafka cluster.
- Select Select from list, and then connect to an existing topic in the Kafka cluster.
- Optional: In the Partition Key(s) section, define the data set
partitioning by performing the following actions:
- Click Add key.
- In the Key field, press the Down Arrow key to select a
property to be used by the Kafka data set as a partitioning key.
By configuring partitioning you can ensure that related records are sent to the same partition. If no partition keys are set, the Kafka data set randomly assigns records to partitions. - Optional: You can configure the JSON Data Transform. It has the ability to map only the
properties that you want to map, or if you have a long JSON message with many attributes,
you can skip some of them. You can also have special characters in your property names
(for example, the $ sign), and then map them to the corresponding Pega properties. For
more information, see Data transform actions for JSON.
- In the header of Dev Studio, click .
- In the Label field, enter the purpose for the new record.
- In the Additional configuration options, select JSON.
- Select the Context and fill the Apply to field.
- In the Add to ruleset field, select the ruleset from the list.
- Click Create and open.
- Optional: Fill in the details of your JSON Data Transform.
- Click Save.
- In your Kafka data set creation ruleform, select Custom as the record format.
- In the Serialization implementation field, enter: com.pega.dsm.kafka.api.serde.DataTransformSerde.
- Click .
- In the Key field, enter: data.transform.name.
- In the Value field, enter the name of your data transform, that you created previously.
- Optional: If you want to use a different format for records than JSON, in the Record
format section, select Custom and configure the record
settings:
- In the Serialization implementation field, enter a fully qualified Java class name for your PegaSerde implementation.
- Optional: Expand the Additional configuration section and define additional configuration options for the implementation class by clicking Add key value pair and entering properties in the Key and Value fields.
- Click Save.
Previous topic Partition keys for Stream data sets Next topic Creating a Kafka configuration instance