Skip to content

Commit

Permalink
Merge pull request #794 from twmb/790
Browse files Browse the repository at this point in the history
kgo: add TopicID to the FetchTopic type
  • Loading branch information
twmb authored Oct 15, 2024
2 parents 581d7ef + 4bfb0c6 commit 6028e72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kgo/record_and_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ func (p *FetchPartition) EachRecord(fn func(*Record)) {
type FetchTopic struct {
// Topic is the topic this is for.
Topic string
// TopicID is the ID of the topic, if your cluster supports returning
// topic IDs in fetch responses (Kafka 3.1+).
TopicID [16]byte
// Partitions contains individual partitions in the topic that were
// fetched.
Partitions []FetchPartition
Expand Down Expand Up @@ -560,6 +563,7 @@ func (fs Fetches) EachTopic(fn func(FetchTopic)) {
for topic, partitions := range topics {
fn(FetchTopic{
topic,
[16]byte{},
partitions,
})
}
Expand Down
1 change: 1 addition & 0 deletions pkg/kgo/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ func (s *source) handleReqResp(br *broker, req *fetchRequest, resp *kmsg.FetchRe

fetchTopic := FetchTopic{
Topic: topic,
TopicID: rt.TopicID,
Partitions: make([]FetchPartition, 0, len(rt.Partitions)),
}

Expand Down

0 comments on commit 6028e72

Please sign in to comment.