浏览代码

Merge pull request #1344 from RazOmessi/master

fix auto create topic on metadata request when request version greate…
Vlad Gorodetsky 6 年之前
父节点
当前提交
8457f0b57a
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      client.go

+ 3 - 1
client.go

@@ -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) {