Skip to content

Commit

Permalink
Merge pull request #1344 from RazOmessi/master
Browse files Browse the repository at this point in the history
fix auto create topic on metadata request when request version greate…
  • Loading branch information
bai authored Apr 22, 2019
2 parents 2a49b70 + f5564d5 commit 8457f0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,15 @@ func (client *client) tryRefreshMetadata(topics []string, attemptsRemaining int)
}

for broker := client.any(); broker != nil; broker = client.any() {
allowAutoTopicCreation := true
if len(topics) > 0 {
Logger.Printf("client/metadata fetching metadata for %v from broker %s\n", topics, broker.addr)
} else {
allowAutoTopicCreation = false
Logger.Printf("client/metadata fetching metadata for all topics from broker %s\n", broker.addr)
}

req := &MetadataRequest{Topics: topics}
req := &MetadataRequest{Topics: topics, AllowAutoTopicCreation: allowAutoTopicCreation}
if client.conf.Version.IsAtLeast(V1_0_0_0) {
req.Version = 5
} else if client.conf.Version.IsAtLeast(V0_10_0_0) {
Expand Down

0 comments on commit 8457f0b

Please sign in to comment.