Sfoglia il codice sorgente

Add ReplicationFactor to ListTopics response

Dominic Evans 7 anni fa
parent
commit
0171e3dafb
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      admin.go

+ 3 - 0
admin.go

@@ -192,6 +192,9 @@ func (ca *clusterAdmin) ListTopics() (map[string]TopicDetail, error) {
 		topicDetails := TopicDetail{
 			NumPartitions: int32(len(topic.Partitions)),
 		}
+		if len(topic.Partitions) > 0 {
+			topicDetails.ReplicationFactor = int16(len(topic.Partitions[0].Replicas))
+		}
 		topicsDetailsMap[topic.Name] = topicDetails
 
 		// we populate the resources we want to describe from the MetadataResponse