Skip to content

Commit

Permalink
BrokerAddrs -> Brokers
Browse files Browse the repository at this point in the history
  • Loading branch information
thehydroimpulse committed May 19, 2017
1 parent 886c59e commit fae6601
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down Expand Up @@ -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,

Expand Down
14 changes: 7 additions & 7 deletions consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fae6601

Please sign in to comment.