From e31ffda5f6bd143cc41aab2d5051cf053f7aa6ef Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 22 Jul 2019 14:25:57 +0800 Subject: [PATCH] auto split kafkaURL to array (#280) auto split kafkaURL to array --- examples/consumer-logger/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/consumer-logger/main.go b/examples/consumer-logger/main.go index b4b4ab1f9..ff4f97d6d 100644 --- a/examples/consumer-logger/main.go +++ b/examples/consumer-logger/main.go @@ -5,13 +5,15 @@ import ( "fmt" "log" "os" + "strings" kafka "github.com/segmentio/kafka-go" ) func getKafkaReader(kafkaURL, topic, groupID string) *kafka.Reader { + brokers := strings.Split(kafkaURL, ",") return kafka.NewReader(kafka.ReaderConfig{ - Brokers: []string{kafkaURL}, + Brokers: brokers, GroupID: groupID, Topic: topic, MinBytes: 10e3, // 10KB