@@ -55,7 +55,7 @@ var topicsCmd = &cobra.Command{
55
55
56
56
var topicSetConfig = & cobra.Command {
57
57
Use : "set-config" ,
58
- Short : "set topic config" ,
58
+ Short : "set topic config. requires Kafka >=2.3.0 on broker side and kaf cluster config. " ,
59
59
Example : "kaf topic set-config topic.name \" cleanup.policy=delete\" " ,
60
60
Args : cobra .ExactArgs (2 ),
61
61
Run : func (cmd * cobra.Command , args []string ) {
@@ -64,7 +64,7 @@ var topicSetConfig = &cobra.Command{
64
64
topic := args [0 ]
65
65
66
66
splt := strings .Split (args [1 ], "," )
67
- configs := make (map [string ]* string )
67
+ configs := make (map [string ]sarama. IncrementalAlterConfigsEntry )
68
68
69
69
for _ , kv := range splt {
70
70
s := strings .Split (kv , "=" )
@@ -75,14 +75,17 @@ var topicSetConfig = &cobra.Command{
75
75
76
76
key := s [0 ]
77
77
value := s [1 ]
78
- configs [key ] = & value
78
+ configs [key ] = sarama.IncrementalAlterConfigsEntry {
79
+ Operation : sarama .IncrementalAlterConfigsOperationSet ,
80
+ Value : & value ,
81
+ }
79
82
}
80
83
81
84
if len (configs ) < 1 {
82
85
errorExit ("No valid configs found" )
83
86
}
84
87
85
- err := admin .AlterConfig (sarama .TopicResource , topic , configs , false )
88
+ err := admin .IncrementalAlterConfig (sarama .TopicResource , topic , configs , false )
86
89
if err != nil {
87
90
errorExit ("Unable to alter topic config: %v\n " , err )
88
91
}
0 commit comments