A collection of Single Message Transformations (SMTs) for Apache Kafka Connect.
See the Kafka documentation for more details about configuring transformations.
This transformation serialize part of the original record's data to JSON strings.
The transformation:
- expects the record value/key to be either a
STRUCTor aMAP; - expects it to have a specified field;
Exists in two variants:
org.onliner.kafka.transforms.JsonSerialize$Key- works on keys;org.onliner.kafka.transforms.JsonSerialize$Value- works on values.
The transformation defines the following configurations:
-
fields- List of fields to serialize. Cannot benullor empty. -
Here's an example of this transformation configuration:
transforms=encode
transforms.encode.type=org.onliner.kafka.transforms.JsonSerialize$Value
transforms.encode.fields=comma,separated,list,of,fieldsThis transformation deserialize JSON strings of the original record's data to structure.
The transformation:
- expects the record value/key to be a
JSONstring; - expects it to have a specified field;
- expects
JSONstring doesn't contain arrays;
Exists in two variants:
org.onliner.kafka.transforms.JsonDeserialize$Key- works on keys;org.onliner.kafka.transforms.JsonDeserialize$Value- works on values.
The transformation defines the following configurations:
fields- List of fields to serialize. Cannot benullor empty.
Here's an example of this transformation configuration:
transforms=decode
transforms.decode.type=org.onliner.kafka.transforms.JsonDeserialize$Value
transforms.decode.fields=comma,separated,list,of,fieldsThis transformation concat fields of the original record's data to single string with delimiter.
The transformation:
- expects the record value/key to be either a
STRUCTor aMAP;
Exists in two variants:
org.onliner.kafka.transforms.ConcatFields$Key- works on keys;org.onliner.kafka.transforms.ConcatFields$Value- works on values.
The transformation defines the following configurations:
fields- List of fields to concat. Cannot benullor empty.delimiter- Delimiter for concat. Cannot benullor empty.output- Output field. Cannot benullor empty.
transforms=concat
transforms.concat.type=org.onliner.kafka.transforms.ConcatFields$Value
transforms.concat.fields=latitude,longitude
transforms.concat.delimiter=,
transforms.concat.output=locationThis transformation insert UUID v5 based on fields of the original record's data.
The transformation:
- expects the record value/key to be either a
STRUCTor aMAP;
Exists in two variants:
org.onliner.kafka.transforms.InsertUuid$Key- works on keys;org.onliner.kafka.transforms.InsertUuid$Value- works on values.
The transformation defines the following configurations:
fields- List of fields to base uuid on. Cannot benullor empty.output- Output field. Cannot benullor empty.namespace- Parent UUID namespace. Can benull. Default to NAMESPACE_URL (6ba7b811-9dad-11d1-80b4-00c04fd430c8)
transforms=uuid
transforms.uuid.type=org.onliner.kafka.transforms.InsertUuid$Value
transforms.uuid.fields=foo,bar
transforms.uuid.output=idThis transformation assign partition for message based on specified group and workers num.
The transformation defines the following configurations:
partitions- Total number of topic partitions.workers- Number of workers. Default to number of partitionsgroup_key- Group header key name. Default 'group'spread_key- Spread header key name. Default 'spread'
transforms=group_partitioner
transforms.group_partitioner.type=org.onliner.kafka.transforms.GroupPartitioner
transforms.group_partitioner.partitions=192
transforms.group_partitioner.workers=48This transformation puts specified fields of the original record's data to the new field as a map
The transformation:
- expects the record value/key to be either a
STRUCTor aMAP;
Exists in two variants:
org.onliner.kafka.transforms.MakeMap$Key- works on keys;org.onliner.kafka.transforms.MakeMap$Value- works on values.
The transformation defines the following configurations:
fields- List of field mappings in format from_field:to_field. Cannot benullor empty.output- Output field. Cannot benullor empty.
Here's an example of this transformation configuration:
transforms=makemap
transforms.makemap.type=org.onliner.kafka.transforms.MakeMap$Value
transforms.makemap.fields=user_type:type,user_id:id
transforms.makemap.output=userThis project is licensed under the MIT license.
Apache Kafka and Apache Kafka Connect are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.