关于golang编写的kafka客户端消费者创建的问题
本人刚刚接触go语言,在用go语言写kafka消费者的时候遇到了如下问题:panic: kafka server: Offset's topic has not yet been created.可以确定是有这个topic的,而且用kafka-console-consumer.sh也是可以正常消费。go语言代码如下:
brokers := []string{"xxxxxxx:9092","xxxxxxx:9092","xxxxxxx:9092"}
topics := []string{"test"}
config := cluster.NewConfig()
config.Consumer.Return.Errors = true
config.Consumer.Offsets.CommitInterval=1*time.Second
config.Consumer.Offsets.Initial=sarama.OffsetNewest
config.Group.Return.Notifications = true
consumer, err := cluster.NewConsumer(brokers, "test_group", topics, config)
if err != nil {
panic(err)
}
defer consumer.Close()
有木有会的大佬指点一下!谢谢