broker config
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.xuxd.kafka.console.service;
|
||||
|
||||
import com.xuxd.kafka.console.beans.ResponseData;
|
||||
import com.xuxd.kafka.console.beans.enums.AlterType;
|
||||
import org.apache.kafka.clients.admin.ConfigEntry;
|
||||
|
||||
/**
|
||||
* kafka-console-ui.
|
||||
@@ -13,4 +15,6 @@ public interface ConfigService {
|
||||
ResponseData getTopicConfig(String topic);
|
||||
|
||||
ResponseData getBrokerConfig(String brokerId);
|
||||
|
||||
ResponseData alterBrokerConfig(String brokerId, ConfigEntry entry, AlterType type);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xuxd.kafka.console.service.impl;
|
||||
|
||||
import com.xuxd.kafka.console.beans.ResponseData;
|
||||
import com.xuxd.kafka.console.beans.enums.AlterType;
|
||||
import com.xuxd.kafka.console.beans.vo.ConfigEntryVO;
|
||||
import com.xuxd.kafka.console.service.ConfigService;
|
||||
import java.util.List;
|
||||
@@ -9,6 +10,7 @@ import kafka.console.ConfigConsole;
|
||||
import org.apache.kafka.clients.admin.ConfigEntry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import scala.Tuple2;
|
||||
|
||||
/**
|
||||
* kafka-console-ui.
|
||||
@@ -34,4 +36,17 @@ public class ConfigServiceImpl implements ConfigService {
|
||||
return ResponseData.create().data(vos).success();
|
||||
}
|
||||
|
||||
@Override public ResponseData alterBrokerConfig(String brokerId, ConfigEntry entry, AlterType type) {
|
||||
Tuple2<Object, String> tuple2 = null;
|
||||
switch (type) {
|
||||
case SET:
|
||||
tuple2 = configConsole.setBrokerConfig(brokerId, entry);
|
||||
break;
|
||||
case DELETE:
|
||||
tuple2 = configConsole.deleteBrokerConfig(brokerId, entry);
|
||||
break;
|
||||
}
|
||||
return (boolean) tuple2._1() ? ResponseData.create().success() : ResponseData.create().failed(tuple2._2());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user