CONFLUENT PLATFORM
The following provides usage information for the Apache Kafka® SMT org.apache.kafka.connect.transforms.HoistField.
org.apache.kafka.connect.transforms.HoistField
If the data has a schema, wrap data using the specified field name in a Struct; if the data does not have a schema, wrap data using the specified field name in a Map.
Use the concrete transformation type designed for the record key (org.apache.kafka.connect.transforms.HoistField$Key) or value (org.apache.kafka.connect.transforms.HoistField$Value).
org.apache.kafka.connect.transforms.HoistField$Key
org.apache.kafka.connect.transforms.HoistField$Value
The configuration snippet below shows how to use HoistField to wrap the field name in a Struct.
HoistField
"transforms": "HoistField", "transforms.HoistField.type": "org.apache.kafka.connect.transforms.HoistField$Value", "transforms.HoistField.field": "line"
Messages sent:
Foo Bar
Topic result:
{"line":"Foo"} {"line":"Bar"}
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.