R - The type of record (must be an implementation of ConnectRecord)public interface Transformation<R extends ConnectRecord<R>> extends org.apache.kafka.common.Configurable, Closeable
Connectors can be configured with transformations to make lightweight message-at-a-time modifications.
Kafka Connect may discover implementations of this interface using the Java ServiceLoader mechanism. To support this, implementations of this interface should also contain a service provider configuration file in META-INF/services/org.apache.kafka.connect.transforms.Transformation.
| Modifier and Type | Method and Description |
|---|---|
R | apply(R record)Apply transformation to the record and return another record object (which may be record itself) or null, corresponding to a map or filter operation respectively. |
void | close()Signal that this transformation instance will no longer will be used. |
org.apache.kafka.common.config.ConfigDef | config()Configuration specification for this transformation. |
R apply(R record)
record and return another record object (which may be record itself) or null, corresponding to a map or filter operation respectively. A transformation must not mutate objects reachable from the given record (including, but not limited to, Headers, Structs, Lists, and Maps). If such objects need to be changed, a new ConnectRecord should be created and returned.
The implementation must be thread-safe.
record - the record to be transformed; may not be nullorg.apache.kafka.common.config.ConfigDef config()
void close()
close in interface AutoCloseableclose in interface Closeable