From 5200eb197082495227fb9d19f4303a8e3edee948 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 7 Feb 2024 14:22:04 +0100 Subject: wip --- consumer.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/consumer.go b/consumer.go index a8c6346..b9c1b45 100644 --- a/consumer.go +++ b/consumer.go @@ -29,6 +29,17 @@ func main() { os.Exit(1) } + partitions, err := c.Assignment() + if err != nil { + fmt.Printf("Failed to get assignments: %s", err) + os.Exit(1) + } + + fmt.Printf("Consuming %d partitions: \n", len(partitions)) + for i, partition := range partitions { + fmt.Printf(" #%d: %s\n", i+1, partition.String()) + } + topic := "purchases" err = c.SubscribeTopics([]string{topic}, nil) // Set up a channel for handling Ctrl-C, etc -- cgit v1.2.3