Skip to content

Commit f372bc3

Browse files
twmbortuman
authored andcommitted
Merge pull request twmb#794 from twmb/790
kgo: add TopicID to the FetchTopic type
1 parent eb11971 commit f372bc3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pkg/kgo/record_and_fetch.go

+4
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ func (p *FetchPartition) EachRecord(fn func(*Record)) {
312312
type FetchTopic struct {
313313
// Topic is the topic this is for.
314314
Topic string
315+
// TopicID is the ID of the topic, if your cluster supports returning
316+
// topic IDs in fetch responses (Kafka 3.1+).
317+
TopicID [16]byte
315318
// Partitions contains individual partitions in the topic that were
316319
// fetched.
317320
Partitions []FetchPartition
@@ -598,6 +601,7 @@ func (fs Fetches) EachTopic(fn func(FetchTopic)) {
598601
for topic, partitions := range topics {
599602
fn(FetchTopic{
600603
topic,
604+
[16]byte{},
601605
partitions,
602606
})
603607
}

pkg/kgo/source.go

+1
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ func (s *source) handleReqResp(br *broker, req *fetchRequest, resp *kmsg.FetchRe
11151115

11161116
fetchTopic := FetchTopic{
11171117
Topic: topic,
1118+
TopicID: rt.TopicID,
11181119
Partitions: make([]FetchPartition, 0, len(rt.Partitions)),
11191120
}
11201121

0 commit comments

Comments
 (0)