Determine Kafka payload format - connect_cdc_sqdata - Latest

Connect CDC (SQData) Kafka Quickstart

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (SQData)
Version
Latest
ft:locale
en-US
Product name
Connect CDC (SQData)
ft:title
Connect CDC (SQData) Kafka Quickstart
Copyright
2024
First publish date
2000
ft:lastEdition
2026-08-24
ft:lastPublication
2026-08-24T13:32:26.256000
L1_Product_Gateway
Integrate
L2_Product_Segment
Data Integration
L3_Product_Brand
Precisely Connect
L4_Investment_Segment
Application Data Integration
L5_Product_Group
ADI - Connect
L6_Product_Name
Connect CDC
Table 1. Changes in this topic
Change type Description
Updated in version 5.0.6 Added Protobuf to the supported Kafka payload formats. Added OF PROTOBUF FORMAT CONFLUENT syntax block. Added note clarifying that Protobuf uses binary encoding.

Precisely supports a variety of target formats for Kafka Topics, including JSON, AVRO, Protobuf, and delimited. JSON is the preferred format for streaming changed data (CDC), particularly while testing as it is self-described. AVRO is essentially identical to JSON except that the Schema is maintained separately and the Kafka messages will have a significantly lighter payload compared to JSON. Protobuf is a binary serialization format that provides even smaller payloads and faster serialization than AVRO; it always requires a Confluent Schema Registry.

With AVRO, Protobuf, and JSON, you have the option of replicating an entire source record/row, including the before and after image for updates, without any mapping. This is performed via the REPLICATE function and the examples provided later in this document utilize the source descriptions to generate the target kafka payload.

You also have the option of customizing your output with the source to target mapping and dynamic construction of JSON with a custom payload format using Relational DDL type syntax and explicit source to target column mapping. While the custom target DDL can use any combination of upper and lower case as well as hyphens or underscores as the Kafka object names, we highly recommend against hyphens and also highly recommend using all lower case characters. The reason is that both are the defacto standards in the open source Kafka and Java communities. While you may be just getting started with Kafka, most large Kafka and Hadoop users later choose to separate the schemas from the data payload by using AVRO. While JSON is easy for a human to read it consumes significantly more storage. AVRO is one method of separating the two and it imposes much stricter rules on object names and data types.

You can also create a custom message using the PRINTF function. Please note that the scope of this document is not intended to discuss custom JSON. Contact Support for assistance with this type of processing.

Note: Both JSON and AVRO formatted records are always in Unicode (UTF-8) with the translation from the source codepage/CCSID (i.e. EBCIDC/1047) performed automatically by the engine.
Note: Protobuf formatted records use binary encoding. Only the text values within a Protobuf message (such as character fields) are UTF-8; the message payload itself is binary, not plain text.
Syntax - JSON
DATASTORE kafka:///*                       -- specify dynamic topic
        OF JSON                           -- specify JSON format
        AS TARGET
        DESCRIBED BY GROUP DB2_SOURCE     -- use source for REPLICATE
Sample
{“object_name”:SQDATA.EMPLOYEE,
"stck":"00d16918eb93309dc0",
"timestamp":"2018-06-01-13.18.41.780264",
"change_op":"U",
"after_image":
{
"empno":“000010”,
"first_name":“SANDRA”,
”midinit":“i”,
“last_name”:“HAAS”,
“workdept”:“A00”,
“phone_no":"3978",
"hire_date":"1978-09-15",
"job":"PRES",
"ed_level":14,
"sex":"f",
"birth_date":"1954-03-31",
"salary":59250.00,
"bonus":6600.00,
"comm":2340.00
},
"before_image":
{
"empno":“000010”,
"first_name":“CHRISTINE”,
”midinit":“I”,
“last_name”:“HAAS”,
“workdept”:“A00”,
“phone_no":"3978",
"hire_date":"1978-09-15",
"job":"PRES",
"ed_level":14,
"sex":"f",
"birth_date":"1954-03-31",
"salary":59250.00,
"bonus":6600.00,
"comm":2340.00
}
}
Syntax - AVRO
DATASTORE kafka:///*                       -- specify dynamic topic
        OF AVRO                            -- specify AVRO format
        AS TARGET
        DESCRIBED BY GROUP DB2_SOURCE      -- use source for REPLICATE
Sample - AVRO Schema
{"type":"record","name":"db2avro_emp_value",
"fields":[
{"name":"change_op","type":"string"},
{"name":"object_name","type":"string"},
{"name":"alias","type":["null","string"],"default":null},
{"name":"stck","type":["null","bytes"],"default":null},
{"name":"timestamp","type":["null","string"],"default":null},
{"name":"seq","type":["null","long"],"default":null},
{"name":"timestamp_ms","type":"string","default":""},
{"name":"after_image","type":["null",{"type":"record","name":"db2avro_emp_value_image",
"fields":[
{"name":"empno","type":"string","default":""},
{"name":"firstnme","type":"string","default":""},
{"name":"midinit","type":"string","default":""},
{"name":"lastname","type":"string","default":""},
{"name":"workdept","type":["null","string"],"default":null},
{"name":"phoneno","type":["null","string"],"default":null},
{"name":"hiredate","type":["null","string"],"default":null},
{"name":"job","type":["null","string"],"default":null},
{"name":"edlevel","type":["null","int"],"default":null},
{"name":"sex","type":["null","string"],"default":null},
{"name":"birthdate","type":["null","string"],"default":null},
{"name":"salary","type":["null",{"type":"bytes","logicalType": "decimal","precision":9,"scale":2}],"default":null},
{"name":"bonus","type":["null",{"type":"bytes","logicalType": "decimal","precision":9,"scale":2}],"default":null},
{"name":"comm","type":["null",{"type":"bytes","logicalType": "decimal","precision":9,"scale":2}],"default":null}
]}]},
{"name":"before_image","type":["null","db2avro_emp_value_image"]}]}

Sample - AVRO data payload

No sample payload is included because in addition to removing the schema information and adding a header containing the Schema name, Registry ID number and date/time stamps, other formatting changes make the content of the file all but unreadable. For this reason Precisely suggests testing first with human readable JSON formatted output.

Syntax - PROTOBUF
DATASTORE kafka:///*                       -- specify dynamic topic
        OF PROTOBUF                        -- specify Protobuf format
        FORMAT CONFLUENT                   -- Confluent Schema Registry required
        AS TARGET
        DESCRIBED BY GROUP DB2_SOURCE      -- use source for REPLICATE