muralibasani commented on code in PR #21676:
URL: https://github.com/apache/kafka/pull/21676#discussion_r3564475762


##########
clients/src/main/java/org/apache/kafka/clients/producer/ProducerRecord.java:
##########
@@ -81,6 +83,35 @@ public ProducerRecord(String topic, Integer partition, Long 
timestamp, K key, V
         this.value = value;
         this.timestamp = timestamp;
         this.headers = new RecordHeaders(headers);
+        this.rawSerializedHeaders = null;
+    }
+
+    /**
+     * Creates a record carrying pre-serialized header bytes. When this 
constructor is used, the
+     * producer writes {@code rawSerializedHeaders} directly into the record 
batch without
+     * deserializing or re-serializing individual headers. The {@code 
rawSerializedHeaders} must
+     * use the standard Kafka header wire format: {@code 
[count(varint)][header1][header2]...},
+     * or be empty (length 0) for zero headers.
+     *
+     * <p>This is intended for internal use (e.g., Kafka Streams changelog 
writing) where headers
+     * are already available in serialized form and the deserialization 
round-trip should be avoided.
+     */
+    public ProducerRecord(String topic, Integer partition, Long timestamp, K 
key, V value, byte[] rawSerializedHeaders) {

Review Comment:
   Thanks @aliehsaeedii 
   Agree with the kip process and the need to avoid it.
   I've switched to the internal-carrier approach like you mentioned and also 
dropped the public API.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to