Skip to content

Commit

Permalink
kgo: add TopicID to the FetchTopic type
Browse files Browse the repository at this point in the history
Closes #790.
  • Loading branch information
twmb committed Jul 29, 2024
1 parent d5978bd commit 4bfb0c6
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 4bfb0c6

Please sign in to comment.