A single message transformation (SMT) modifies each record as it moves through a Kafka Connect source or sink connector. It handles focused changes such as renaming fields, masking data, or moving a value into the key. section 11.7 section 11.10
For a source connector, the transformation runs after external data becomes Kafka Connect’s internal structure and before the record is written to Kafka. For a sink connector, it runs after topic data is converted internally and before the sink receives it. section 11.7
Configure SMTs as an ordered pipeline in the connector JSON sent to the Kafka Connect REST API:
- List transformation names in the transforms property, choosing names such as rename or extractKey. section 11.7
- Declare each transformation’s Java class with transforms.<name>.type and add its specific settings. section 11.7
- Rely on the comma-separated list to determine execution order. section 11.7
Rename and extract a product identifier
A ReplaceField transformation can exclude dropme and rename foo to bar. A ValueToKey transformation can move product_id from the value into the key, followed by ExtractField$Key to retain that field as the key.
SMTs are deliberately narrow. Avoid using them as a full ETL layer; complex transformations belong in Kafka Streams or another stream-processing framework. section 11.7

