Fixed kafka client run of brokers and index out of range issues

This commit is contained in:
Ubuntu
2018-02-27 20:17:45 +03:00
committed by Leonid Bugaev
parent 1f62555ca8
commit a65256d707
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"log"
"strings"
"github.com/Shopify/sarama"
"github.com/Shopify/sarama/mocks"
@@ -27,7 +28,8 @@ func NewKafkaInput(address string, config *KafkaConfig) *KafkaInput {
con = config.consumer
} else {
var err error
con, err = sarama.NewConsumer([]string{config.host}, c)
//con, err = sarama.NewConsumer([]string{config.host}, c)
con, err = sarama.NewConsumer(strings.Split(config.host,","), c)
if err != nil {
log.Fatalln("Failed to start Sarama(Kafka) consumer:", err)