Yunyung commented on code in PR #20524:
URL: https://github.com/apache/kafka/pull/20524#discussion_r2343830136
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/PlaintextConsumerTest.java:
##########
@@ -217,6 +231,33 @@ var record = new ProducerRecord<>(TP.topic(),
TP.partition(), null, "key".getByt
}
}
+ private void testHeadersOrderPreserved(Map<String, Object> consumerConfig)
throws Exception {
+ var numRecords = 1;
+
+ try (Producer<byte[], byte[]> producer = cluster.producer();
+ Consumer<byte[], byte[]> consumer =
cluster.consumer(consumerConfig)
+ ) {
+ var record = new ProducerRecord<>(TP.topic(), TP.partition(),
null, "key".getBytes(), "value".getBytes());
+ record.headers().add("headerKey", "headerValue".getBytes());
+ record.headers().add("headerKey2", "headerValue2".getBytes());
+ record.headers().add("headerKey3", "headerValue3".getBytes());
+ producer.send(record);
+
+ assertEquals(0, consumer.assignment().size());
+ consumer.assign(List.of(TP));
+ assertEquals(1, consumer.assignment().size());
+
+ consumer.seek(TP, 0);
+ var records = consumeRecords(consumer, numRecords);
+ assertEquals(numRecords, records.size());
Review Comment:
Done.
##########
docs/implementation.html:
##########
@@ -101,6 +101,7 @@ <h5 class="anchor-heading"><a id="recordheader"
class="anchor-link"></a><a href=
headerKey: String
headerValueLength: varint
Value: byte[]</code></pre>
+ <p>The key of a record header is guaranteed to be non-null, while the
value of a record header may be null. The order of headers in a record is
preserved when producing and consuming.</p>
Review Comment:
Done.
--
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]