summaryrefslogtreecommitdiff
path: root/consumer.go
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-02-07 14:22:04 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-02-07 14:22:04 +0100
commit5200eb197082495227fb9d19f4303a8e3edee948 (patch)
tree4fd44f2772586ee0ad4d38dee7fce57db24e12d3 /consumer.go
parentacf44b68569f6615d373f05f92671afecb296af8 (diff)
downloadkafka-sandbox-5200eb197082495227fb9d19f4303a8e3edee948.tar.gz
kafka-sandbox-5200eb197082495227fb9d19f4303a8e3edee948.tar.bz2
kafka-sandbox-5200eb197082495227fb9d19f4303a8e3edee948.tar.xz
kafka-sandbox-5200eb197082495227fb9d19f4303a8e3edee948.zip
wip
Diffstat (limited to 'consumer.go')
-rw-r--r--consumer.go11
1 files changed, 11 insertions, 0 deletions
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