diff --git a/Readme.md b/Readme.md index 1b094515e..31ac5616f 100644 --- a/Readme.md +++ b/Readme.md @@ -14,7 +14,7 @@ import "github.com/segmentio/kafka-go" ctx := context.Background() reader, err := kafka.NewReader(ReaderConfig{ - BrokerAddrs: []string{"localhost:9092"}, + Brokers: []string{"localhost:9092"}, Topic: "events", Partition: 0, }) @@ -50,7 +50,7 @@ config := kafka.GroupConfig{ Name: "my-group-name", // Consul address Addr: "http://localhost:8500", - BrokerAddrs: []string{"localhost:9092"}, + Brokers: []string{"localhost:9092"}, Topic: "foobar", Partitions: 100, diff --git a/consul.go b/consul.go index 8a32b9dc5..941eb7ba5 100644 --- a/consul.go +++ b/consul.go @@ -20,10 +20,10 @@ type consulReader struct { } type GroupConfig struct { - Name string - Addr string - BrokerAddrs []string - Topic string + Name string + Addr string + Brokers []string + Topic string // Number of partitions Partitions int @@ -63,9 +63,9 @@ func NewGroupReader(config GroupConfig) (Reader, error) { } consulReader.reader, err = NewReader(ReaderConfig{ - BrokerAddrs: config.BrokerAddrs, - Topic: config.Topic, - Partition: partitionID, + Brokers: config.Brokers, + Topic: config.Topic, + Partition: partitionID, RequestMaxWaitTime: config.RequestMaxWaitTime, RequestMinBytes: config.RequestMinBytes, diff --git a/kafka.go b/kafka.go index 7893958cb..8941ab0e1 100644 --- a/kafka.go +++ b/kafka.go @@ -17,9 +17,9 @@ const ( ) type ReaderConfig struct { - BrokerAddrs []string - Topic string - Partition int + Brokers []string + Topic string + Partition int // Kafka requests wait for `RequestMaxWaitTime` OR `RequestMinBytes`, but // always stops at `RequestMaxBytes`. @@ -56,7 +56,7 @@ func NewReader(config ReaderConfig) (Reader, error) { conf := sarama.NewConfig() conf.Version = sarama.V0_10_1_0 - client, err := sarama.NewClient(config.BrokerAddrs, conf) + client, err := sarama.NewClient(config.Brokers, conf) if err != nil { return nil, err } diff --git a/kafka_test.go b/kafka_test.go index c0b520f83..1b21bdc2d 100644 --- a/kafka_test.go +++ b/kafka_test.go @@ -77,7 +77,7 @@ func TestReader(t *testing.T) { for _, test := range tests { t.Run(test.scenario, func(t *testing.T) { config := ReaderConfig{ - BrokerAddrs: []string{"localhost:9092"}, + Brokers: []string{"localhost:9092"}, Topic: "test", Partition: 0, RequestMaxWaitTime: 100 * time.Millisecond,