CONFLUENT PLATFORM
The following provides usage information for the Apache Kafka® SMT org.apache.kafka.connect.transforms.InsertField.
org.apache.kafka.connect.transforms.InsertField
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).
org.apache.kafka.connect.transforms.InsertField$Key
org.apache.kafka.connect.transforms.InsertField$Value
This configuration snippet shows how to use InsertField to insert a static field labeled MessageSource using a static value of Kafka Connect Framework.
InsertField
MessageSource
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"}
{"author": "Philip K. Dick", "character": "Palmer Eldritch"}
After: {"author": "Philip K. Dick", "character": "Palmer Eldritch", "MessageSource": "Kafka Connect framework"}
{"author": "Philip K. Dick", "character": "Palmer Eldritch", "MessageSource": "Kafka Connect framework"}
offset.field
!
?
partition.field
static.field
static.value
timestamp.field
topic.field
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 Filter (Apache Kafka), predicates can conditionally filter out specific records. For details and examples, see Predicates.