You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by mi...@apache.org on 2020/11/26 22:40:52 UTC

[kafka] branch trunk updated: KAFKA-10720: Document prohibition on header mutation by SMTs (#9597)

This is an automated email from the ASF dual-hosted git repository.

mimaison pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0df4615  KAFKA-10720: Document prohibition on header mutation by SMTs (#9597)
0df4615 is described below

commit 0df461582c78449fd39e35b241a77a7acf5735e2
Author: Tom Bentley <to...@users.noreply.github.com>
AuthorDate: Thu Nov 26 22:39:41 2020 +0000

    KAFKA-10720: Document prohibition on header mutation by SMTs (#9597)
    
    
    Reviewers: Mickael Maison <mi...@gmail.com>, Chris Egerton <fe...@gmail.com>
---
 .../java/org/apache/kafka/connect/transforms/Transformation.java     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java b/connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java
index 0803fa8..238a642 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java
+++ b/connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java
@@ -33,6 +33,11 @@ public interface Transformation<R extends ConnectRecord<R>> extends Configurable
      * Apply transformation to the {@code record} and return another record object (which may be {@code record} itself) or {@code null},
      * corresponding to a map or filter operation respectively.
      *
+     * A transformation must not mutate objects reachable from the given {@code record}
+     * (including, but not limited to, {@link org.apache.kafka.connect.header.Headers Headers},
+     * {@link org.apache.kafka.connect.data.Struct Structs}, {@code Lists}, and {@code Maps}).
+     * If such objects need to be changed, a new ConnectRecord should be created and returned.
+     *
      * The implementation must be thread-safe.
      */
     R apply(R record);