-
Notifications
You must be signed in to change notification settings - Fork 14.7k
KAFKA-19644: Enhance the documentation for producer headers and integration tests #20524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
841a915
64783a6
cb766c5
5445a9c
a6bfd07
7839ce6
40d0d55
765e2d5
ce48361
4876f2f
2e214f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,21 @@ public void testAdd() { | |
assertEquals(2, getCount(headers)); | ||
} | ||
|
||
@Test | ||
public void testAddHeadersPreserveOder() { | ||
|
||
Headers headers = new RecordHeaders(); | ||
headers.add(new RecordHeader("key", "value".getBytes())); | ||
headers.add(new RecordHeader("key2", "value2".getBytes())); | ||
headers.add(new RecordHeader("key3", "value3".getBytes())); | ||
|
||
Header[] headersArr = headers.toArray(); | ||
assertHeader("key", "value", headersArr[0]); | ||
assertHeader("key2", "value2", headersArr[1]); | ||
assertHeader("key3", "value3", headersArr[2]); | ||
|
||
assertEquals(3, getCount(headers)); | ||
} | ||
|
||
@Test | ||
public void testRemove() { | ||
Headers headers = new RecordHeaders(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add comments to the public API There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
<p>We use the same varint encoding as Protobuf. More information on the latter can be found <a href="https://developers.google.com/protocol-buffers/docs/encoding#varints">here</a>. The count of headers in a record | ||
is also encoded as a varint.</p> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add documents and ut for the
Iterable#remove
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Thanks!