作者 唐旭辉

.

... ... @@ -115,12 +115,12 @@ func (r *Runer) InitConsumer() error {
clusterCfg.Consumer.Offsets.Initial = sarama.OffsetOldest
clusterCfg.Group.Return.Notifications = true
clusterCfg.Version = sarama.V0_10_2_1
khosts := []string{"192.168.0.252:9092", "192.168.0.251:9092", "192.168.0.250:9092"}
groupid := "partnermg_dev"
topic := []string{"topic_test"}
// khosts := []string{"192.168.0.252:9092", "192.168.0.251:9092", "192.168.0.250:9092"}
// groupid := "partnermg_dev"
// topic := []string{"topic_test"}
logs.Debug(r.msgConsumer.kafkaHosts, r.msgConsumer.groupId, r.msgConsumer.topics)
// consumer, err := cluster.NewConsumer(r.msgConsumer.kafkaHosts, r.msgConsumer.groupId, r.msgConsumer.topics, clusterCfg)
consumer, err := cluster.NewConsumer(khosts, groupid, topic, clusterCfg)
consumer, err := cluster.NewConsumer(r.msgConsumer.kafkaHosts, r.msgConsumer.groupId, r.msgConsumer.topics, clusterCfg)
// consumer, err := cluster.NewConsumer(khosts, groupid, topic, clusterCfg)
if err != nil {
msg := fmt.Sprintf("Create kafka consumer error: %v. config: %v", err, clusterCfg)
logs.Error(msg)
... ...