Interface Transformation<R extends ConnectRecord<R>>
- Type Parameters:
R
- The type of record (must be an implementation ofConnectRecord
)
- All Superinterfaces:
AutoCloseable
,Closeable
,Configurable
Single message transformation for Kafka Connect record types.
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
.
-
Method Summary
Modifier and TypeMethodDescriptionApply transformation to therecord
and return another record object (which may berecord
itself) ornull
, corresponding to a map or filter operation respectively.void
close()
Signal that this transformation instance will no longer will be used.config()
Configuration specification for this transformation.Methods inherited from interface org.apache.kafka.common.Configurable
configure
-
Method Details
-
apply
Apply transformation to therecord
and return another record object (which may berecord
itself) ornull
, 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
, andMaps
). If such objects need to be changed, a newConnectRecord
should be created and returned.The implementation must be thread-safe.
- Parameters:
record
- the record to be transformed; may not be null- Returns:
- the transformed record; may be null to indicate that the record should be dropped
-
config
ConfigDef config()Configuration specification for this transformation. -
close
void close()Signal that this transformation instance will no longer will be used.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-