[英]how to create consumer group with multiple consumers in confluent-kafka-go?
As i'm new to Go and kafka, i need to implement consumer groups using confluent-kafka-go module.由于我是 Go 和 kafka 的新手,我需要使用 confluent-kafka-go 模块来实现消费者组。 can anyone help me out?
谁能帮我吗?
Thanks in advance提前致谢
With confluent-kafka-go
, you just need to set group.id
in your consumer configuration to have it join/create a group.使用
confluent-kafka-go
,您只需在使用者配置中设置group.id
即可使其加入/创建组。
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其中一个样本表明: https://github.com/confluentinc/confluent-kafka-go/blob/master/examples/consumer_example/consumer_example.go
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.