3

As i'm new to Go and kafka , i need to implement consumer groups using confluent-kafka-go module. can anyone help me out?

Thanks in advance

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Vani Polnedi
  • 595
  • 2
  • 4
  • 19

1 Answers1

2

With confluent-kafka-go, you just need to set group.id in your consumer configuration to have it join/create a group.

For example:

c, err := kafka.NewConsumer(&kafka.ConfigMap{
        "bootstrap.servers": "localhost:9092",
        "group.id":          "my-group"})

One of the samples demonstrates that: https://github.com/confluentinc/confluent-kafka-go/blob/master/examples/consumer_example/consumer_example.go

Mickael Maison
  • 25,067
  • 7
  • 71
  • 68