Kafka Connect InsertField SMT Usage Reference for Confluent Cloud
The following provides usage information for the Apache Kafka® SMT org.apache.kafka.connect.transforms.InsertField.
Description
Insert fields using attributes from the record metadata or a configured static value.
Use the concrete transformation type designed for the record key (org.apache.kafka.connect.transforms.InsertField$Key) or value (org.apache.kafka.connect.transforms.InsertField$Value).
Example
This configuration snippet shows how to use InsertField to insert a static
field labeled MessageSource using a static value of Kafka Connect
Framework.
"transforms": "InsertField",
"transforms.InsertField.type": "org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.InsertField.static.field": "MessageSource",
"transforms.InsertField.static.value": "Kafka Connect framework"
Before: {"author": "Philip K. Dick", "character": "Palmer Eldritch"}
After: {"author": "Philip K. Dick", "character": "Palmer Eldritch", "MessageSource": "Kafka Connect framework"}
Tip
For additional examples, see Insert Field for managed connectors.
Properties
Name |
Description |
Type |
Default |
Valid Values |
Importance |
|---|---|---|---|---|---|
|
Field name for Apache Kafka® offset. This is only applicable to sink connectors. Suffix with |
string |
null |
medium |
|
|
Field name for Kafka partition. Suffix with |
string |
null |
medium |
|
|
Field name for static data field. Suffix with |
string |
null |
medium |
|
|
If field name is configured, the static field value. |
string |
null |
medium |
|
|
Field name for record timestamp. Suffix with |
string |
null |
medium |
|
|
Field name for Kafka topic. Suffix with |
string |
null |
medium |
Predicates
Transformations can be configured with predicates so that the transformation is applied only to records which satisfy a condition. You can use predicates in a transformation chain and, when combined with the Kafka Connect Filter (Kafka) SMT Usage Reference for Confluent Cloud, predicates can conditionally filter out specific records. For details and examples, see Predicates.