Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
Last active August 28, 2020 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinhooke/1aeacba0b3170c5c4187abe53613aed8 to your computer and use it in GitHub Desktop.
Save kevinhooke/1aeacba0b3170c5c4187abe53613aed8 to your computer and use it in GitHub Desktop.
Kafka CMT transform examples
- multiple transforms as a csv list
"transforms": "fieldRenames,recordTimeStamp,constantExample",
- whitelist on field names is case sensitive and needs to match transformed names
this is a list of fields allowed in the output (not the input fields if they are transformed or renamed)
"fields.whitelist": "EXAMPLE,EVENT_TIMESTAMP,EXAMPLE_STRING",
- transforms on field names are case sensitive
"transforms.fieldRenames.type": "org.apache.kafka.connect.transforms.ReplaceField$Value",
"transforms.fieldRenames.renames": "EXPL:EXAMPLE" // from : to
- inserting timestamp from record as a new field
"transforms.recordTimeStamp.type": "org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.recordTimeStamp.timestamp.field": "EVENT_TIMESTAMP",
- inserting a constant strimg
"transforms.constantExample.type": "org.apache.kafka.connect.transforms.InsertField$Value",
"transforms.constantExample.static.field": "EXAMPLE_STRING",
"transforms.constantExample.static.value": "Example value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment