mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-02 02:02:13 +08:00
增加Topic同步任务&Bug修复
This commit is contained in:
@@ -47,7 +47,7 @@ public class GatewayHeartbeatController {
|
||||
|
||||
List<TopicConnectionDO> doList = null;
|
||||
try {
|
||||
doList = JsonUtils.parseTopicConnections(clusterId, jsonObject);
|
||||
doList = JsonUtils.parseTopicConnections(clusterId, jsonObject, System.currentTimeMillis());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=GatewayHeartbeatController||method=receiveTopicConnections||clusterId={}||brokerId={}||msg=parse data failed||exception={}", clusterId, brokerId, e.getMessage());
|
||||
return Result.buildFailure("fail");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class NormalAppController {
|
||||
@RequestMapping(value = "apps/{appId}/basic-info", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result<AppVO> getAppBasicInfo(@PathVariable String appId) {
|
||||
if (accountService.isAdminOrderHandler(SpringTool.getUserName())) {
|
||||
if (accountService.isOpOrRd(SpringTool.getUserName())) {
|
||||
return new Result<>(AppConverter.convert2AppVO(appService.getByAppId(appId)));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class NormalAppController {
|
||||
@RequestMapping(value = "apps/{appId}/topics", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result<List<AppTopicVO>> getAppTopics(@PathVariable String appId,
|
||||
@RequestParam(value = "mine") Boolean mine) {
|
||||
@RequestParam(value = "mine", required = false) Boolean mine) {
|
||||
List<AppTopicDTO> dtoList = appService.getAppTopicDTOList(appId, mine);
|
||||
|
||||
List<AppTopicVO> voList = new ArrayList<>();
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.PartitionOffsetDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumeDetailDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroupDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroup;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.dto.normal.TopicOffsetResetDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupDetailVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupSummaryVO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
|
||||
import com.xiaojukeji.kafka.manager.service.cache.LogicalClusterMetadataManager;
|
||||
@@ -55,7 +55,7 @@ public class NormalConsumerController {
|
||||
@ApiOperation(value = "查询消费Topic的消费组", notes = "")
|
||||
@RequestMapping(value = "{clusterId}/consumers/{topicName}/consumer-groups", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result<List<ConsumerGroupVO>> getConsumeGroups(
|
||||
public Result<List<ConsumerGroupSummaryVO>> getConsumeGroups(
|
||||
@PathVariable Long clusterId,
|
||||
@PathVariable String topicName,
|
||||
@RequestParam(value = "isPhysicalClusterId", required = false) Boolean isPhysicalClusterId) {
|
||||
@@ -63,9 +63,9 @@ public class NormalConsumerController {
|
||||
if (ValidateUtils.isNull(physicalClusterId)) {
|
||||
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
|
||||
}
|
||||
return new Result<>(ConsumerModelConverter.convert2ConsumerGroupVOList(
|
||||
consumerService.getConsumerGroupList(physicalClusterId, topicName))
|
||||
);
|
||||
return new Result<>(ConsumerModelConverter.convert2ConsumerGroupSummaryVOList(
|
||||
consumerService.getConsumerGroupSummaries(physicalClusterId, topicName)
|
||||
));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询消费组的消费详情", notes = "")
|
||||
@@ -95,15 +95,10 @@ public class NormalConsumerController {
|
||||
return Result.buildFrom(ResultStatus.CG_LOCATION_ILLEGAL);
|
||||
}
|
||||
|
||||
ConsumerGroupDTO consumeGroupDTO = new ConsumerGroupDTO(
|
||||
clusterDO.getId(),
|
||||
consumerGroup,
|
||||
new ArrayList<>(),
|
||||
offsetStoreLocation
|
||||
);
|
||||
ConsumerGroup consumeGroup = new ConsumerGroup(clusterDO.getId(), consumerGroup, offsetStoreLocation);
|
||||
try {
|
||||
List<ConsumeDetailDTO> consumeDetailDTOList =
|
||||
consumerService.getConsumeDetail(clusterDO, topicName, consumeGroupDTO);
|
||||
consumerService.getConsumeDetail(clusterDO, topicName, consumeGroup);
|
||||
return new Result<>(
|
||||
ConsumerModelConverter.convert2ConsumerGroupDetailVO(
|
||||
topicName,
|
||||
@@ -113,7 +108,7 @@ public class NormalConsumerController {
|
||||
)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("get consume detail failed, consumerGroup:{}.", consumeGroupDTO, e);
|
||||
LOGGER.error("get consume detail failed, consumerGroup:{}.", consumeGroup, e);
|
||||
}
|
||||
return Result.buildFrom(ResultStatus.OPERATION_FAILED);
|
||||
|
||||
@@ -139,16 +134,11 @@ public class NormalConsumerController {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
|
||||
ConsumerGroupDTO consumerGroupDTO = new ConsumerGroupDTO(
|
||||
physicalClusterId,
|
||||
dto.getConsumerGroup(),
|
||||
new ArrayList<>(),
|
||||
OffsetLocationEnum.getOffsetStoreLocation(dto.getLocation())
|
||||
);
|
||||
ConsumerGroup consumerGroup = new ConsumerGroup(physicalClusterId, dto.getConsumerGroup(), OffsetLocationEnum.getOffsetStoreLocation(dto.getLocation()));
|
||||
List<Result> resultList = consumerService.resetConsumerOffset(
|
||||
clusterDO,
|
||||
dto.getTopicName(),
|
||||
consumerGroupDTO,
|
||||
consumerGroup,
|
||||
offsetDTOList
|
||||
);
|
||||
for (Result result: resultList) {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.xiaojukeji.kafka.manager.web.api.versionone.op;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionAddGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionDeleteGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionModifyGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.service.service.gateway.GatewayConfigService;
|
||||
import com.xiaojukeji.kafka.manager.web.converters.GatewayModelConverter;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@Api(tags = "OP-Gateway配置相关接口(REST)")
|
||||
@RestController
|
||||
public class OpGatewayConfigController {
|
||||
@Autowired
|
||||
private GatewayConfigService gatewayConfigService;
|
||||
|
||||
@ApiOperation(value = "创建Gateway配置", notes = "")
|
||||
@RequestMapping(value = "gateway-configs", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Result createGatewayConfig(@RequestBody OrderExtensionAddGatewayConfigDTO dto) {
|
||||
if (ValidateUtils.isNull(dto) || !dto.legal()) {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
return gatewayConfigService.insert(GatewayModelConverter.convert2GatewayConfigDO(dto));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改Gateway配置", notes = "")
|
||||
@RequestMapping(value = "gateway-configs", method = RequestMethod.PUT)
|
||||
@ResponseBody
|
||||
public Result modifyGatewayConfig(@RequestBody OrderExtensionModifyGatewayConfigDTO dto) {
|
||||
if (ValidateUtils.isNull(dto) || !dto.legal()) {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
return gatewayConfigService.updateById(GatewayModelConverter.convert2GatewayConfigDO(dto));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除Gateway配置", notes = "")
|
||||
@RequestMapping(value = "gateway-configs", method = RequestMethod.DELETE)
|
||||
@ResponseBody
|
||||
public Result deleteGatewayConfig(@RequestBody OrderExtensionDeleteGatewayConfigDTO dto) {
|
||||
if (ValidateUtils.isNull(dto) || !dto.legal()) {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
return gatewayConfigService.deleteById(dto.getId());
|
||||
}
|
||||
}
|
||||
@@ -194,15 +194,22 @@ public class OpUtilsController {
|
||||
if (ValidateUtils.isNull(clusterDO)) {
|
||||
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
|
||||
}
|
||||
String operator = SpringTool.getUserName();
|
||||
|
||||
ResultStatus rs = null;
|
||||
if (RebalanceDimensionEnum.CLUSTER.getCode().equals(reqObj.getDimension())) {
|
||||
rs = adminService.preferredReplicaElection(clusterDO, operator);
|
||||
// 按照Cluster纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.BROKER.getCode().equals(reqObj.getDimension())) {
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getBrokerId(), operator);
|
||||
// 按照Broker纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getBrokerId(), SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.TOPIC.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Topic纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getTopicName(), SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.PARTITION.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Partition纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getTopicName(), reqObj.getPartitionId(), SpringTool.getUserName());
|
||||
} else {
|
||||
// TODO: 19/7/8 Topic维度 & Region维度 优先副本选举
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
return Result.buildFrom(rs);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.xiaojukeji.kafka.manager.web.api.versionone.rd;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.KafkaClientEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.PeakFlowStatusEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.constant.KafkaMetricsCollections;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.cluster.ControllerPreferredCandidate;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.cluster.TopicMetadataVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.ControllerPreferredCandidateVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.RdClusterMetricsVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.ClusterBrokerStatusVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.BrokerOverviewDTO;
|
||||
@@ -26,7 +27,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -168,4 +168,15 @@ public class RdClusterController {
|
||||
public Result<List<TopicMetadataVO>> getTopicMetadatas(@PathVariable("clusterId") Long clusterId) {
|
||||
return new Result<>(ClusterModelConverter.convert2TopicMetadataVOList(clusterId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Controller优先候选的Broker", notes = "滴滴内部引擎特性")
|
||||
@RequestMapping(value = "clusters/{clusterId}/controller-preferred-candidates", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result<List<ControllerPreferredCandidateVO>> getControllerPreferredCandidates(@PathVariable("clusterId") Long clusterId) {
|
||||
Result<List<ControllerPreferredCandidate>> candidateResult = clusterService.getControllerPreferredCandidates(clusterId);
|
||||
if (candidateResult.failed()) {
|
||||
return new Result(candidateResult.getCode(), candidateResult.getMessage());
|
||||
}
|
||||
return Result.buildSuc(ClusterModelConverter.convert2ControllerPreferredCandidateVOList(candidateResult.getData()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiaojukeji.kafka.manager.web.api.versionone.rd;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.GatewayConfigDO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.GatewayConfigVO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.service.service.gateway.GatewayConfigService;
|
||||
import com.xiaojukeji.kafka.manager.web.converters.GatewayModelConverter;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "RD-Gateway配置相关接口(REST)")
|
||||
@RestController
|
||||
public class RdGatewayConfigController {
|
||||
@Autowired
|
||||
private GatewayConfigService gatewayConfigService;
|
||||
|
||||
@ApiOperation(value = "Gateway相关配置信息", notes = "")
|
||||
@RequestMapping(value = "gateway-configs", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Result<List<GatewayConfigVO>> getGatewayConfigs() {
|
||||
List<GatewayConfigDO> doList = gatewayConfigService.list();
|
||||
if (ValidateUtils.isEmptyList(doList)) {
|
||||
return Result.buildSuc();
|
||||
}
|
||||
return Result.buildSuc(GatewayModelConverter.convert2GatewayConfigVOList(doList));
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import com.xiaojukeji.kafka.manager.common.constant.SystemCodeConstant;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumeDetailDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroupDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroup;
|
||||
import com.xiaojukeji.kafka.manager.openapi.common.dto.ConsumeHealthDTO;
|
||||
import com.xiaojukeji.kafka.manager.openapi.common.dto.OffsetResetDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
|
||||
@@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -152,15 +151,10 @@ public class ThirdPartConsumeController {
|
||||
return Result.buildFrom(ResultStatus.CG_LOCATION_ILLEGAL);
|
||||
}
|
||||
|
||||
ConsumerGroupDTO consumeGroupDTO = new ConsumerGroupDTO(
|
||||
clusterDO.getId(),
|
||||
consumerGroup,
|
||||
new ArrayList<>(),
|
||||
offsetStoreLocation
|
||||
);
|
||||
ConsumerGroup consumeGroup = new ConsumerGroup(clusterDO.getId(), consumerGroup, offsetStoreLocation);
|
||||
try {
|
||||
List<ConsumeDetailDTO> consumeDetailDTOList =
|
||||
consumerService.getConsumeDetail(clusterDO, topicName, consumeGroupDTO);
|
||||
consumerService.getConsumeDetail(clusterDO, topicName, consumeGroup);
|
||||
return new Result<>(
|
||||
ConsumerModelConverter.convert2ConsumerGroupDetailVO(
|
||||
topicName,
|
||||
@@ -170,7 +164,7 @@ public class ThirdPartConsumeController {
|
||||
)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("get consume detail failed, consumerGroup:{}.", consumeGroupDTO, e);
|
||||
LOGGER.error("get consume detail failed, consumerGroup:{}.", consumeGroup, e);
|
||||
}
|
||||
return Result.buildFrom(ResultStatus.OPERATION_FAILED);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.xiaojukeji.kafka.manager.web.api.versionone.thirdpart;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.RebalanceDimensionEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.constant.ApiPrefix;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.dto.op.RebalanceDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.SpringTool;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.service.service.AdminService;
|
||||
import com.xiaojukeji.kafka.manager.service.service.ClusterService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/9/23
|
||||
*/
|
||||
@Api(tags = "开放接口-OP相关接口(REST)")
|
||||
@RestController
|
||||
@RequestMapping(ApiPrefix.API_V1_THIRD_PART_PREFIX)
|
||||
public class ThirdPartOpController {
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
@Autowired
|
||||
private ClusterService clusterService;
|
||||
|
||||
@ApiOperation(value = "优先副本选举")
|
||||
@RequestMapping(value = "op/rebalance", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Result preferredReplicaElect(@RequestBody RebalanceDTO reqObj) {
|
||||
if (!reqObj.paramLegal()) {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
ClusterDO clusterDO = clusterService.getById(reqObj.getClusterId());
|
||||
if (ValidateUtils.isNull(clusterDO)) {
|
||||
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
|
||||
}
|
||||
|
||||
ResultStatus rs = null;
|
||||
if (RebalanceDimensionEnum.CLUSTER.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Cluster纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.BROKER.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Broker纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getBrokerId(), SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.TOPIC.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Topic纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getTopicName(), SpringTool.getUserName());
|
||||
} else if (RebalanceDimensionEnum.PARTITION.getCode().equals(reqObj.getDimension())) {
|
||||
// 按照Partition纬度均衡
|
||||
rs = adminService.preferredReplicaElection(clusterDO, reqObj.getTopicName(), reqObj.getPartitionId(), SpringTool.getUserName());
|
||||
} else {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
return Result.buildFrom(rs);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.xiaojukeji.kafka.manager.web.converters;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.BrokerOverviewDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.ClusterDetailDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.cluster.ClusterBrokerStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.cluster.ControllerPreferredCandidate;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.cluster.LogicalCluster;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.cluster.LogicalClusterMetrics;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.dto.rd.ClusterDTO;
|
||||
@@ -15,6 +16,7 @@ import com.xiaojukeji.kafka.manager.common.entity.vo.normal.cluster.TopicMetadat
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.KafkaControllerVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.ClusterBrokerStatusVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.ClusterDetailVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.ControllerPreferredCandidateVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.cluster.RdClusterMetricsVO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.CopyUtils;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ListUtils;
|
||||
@@ -249,4 +251,21 @@ public class ClusterModelConverter {
|
||||
vo.setBrokerReplicaStatusList(clusterBrokerStatus.getBrokerReplicaStatusList());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static List<ControllerPreferredCandidateVO> convert2ControllerPreferredCandidateVOList(List<ControllerPreferredCandidate> candidateList) {
|
||||
if (ValidateUtils.isEmptyList(candidateList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<ControllerPreferredCandidateVO> voList = new ArrayList<>();
|
||||
for (ControllerPreferredCandidate candidate: candidateList) {
|
||||
ControllerPreferredCandidateVO vo = new ControllerPreferredCandidateVO();
|
||||
vo.setBrokerId(candidate.getBrokerId());
|
||||
vo.setHost(candidate.getHost());
|
||||
vo.setStatus(candidate.getStatus());
|
||||
vo.setStartTime(candidate.getStartTime());
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.xiaojukeji.kafka.manager.web.converters;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroup;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroupSummary;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupDetailVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumeDetailDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumerGroupDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupSummaryVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.normal.consumer.ConsumerGroupVO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ListUtils;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,18 +45,34 @@ public class ConsumerModelConverter {
|
||||
return consumerGroupDetailVOList;
|
||||
}
|
||||
|
||||
public static List<ConsumerGroupVO> convert2ConsumerGroupVOList(List<ConsumerGroupDTO> consumeGroupDTOList) {
|
||||
if (consumeGroupDTOList == null || consumeGroupDTOList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
public static List<ConsumerGroupVO> convert2ConsumerGroupVOList(List<ConsumerGroup> consumerGroupList) {
|
||||
if (ValidateUtils.isEmptyList(consumerGroupList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ConsumerGroupVO> consumerGroupVOList = new ArrayList<>();
|
||||
for (ConsumerGroupDTO consumeGroupDTO : consumeGroupDTOList) {
|
||||
for (ConsumerGroup consumerGroup : consumerGroupList) {
|
||||
ConsumerGroupVO vo = new ConsumerGroupVO();
|
||||
vo.setConsumerGroup(consumeGroupDTO.getConsumerGroup());
|
||||
vo.setAppIds(ListUtils.strList2String(consumeGroupDTO.getAppIdList()));
|
||||
vo.setLocation(consumeGroupDTO.getOffsetStoreLocation().location);
|
||||
vo.setConsumerGroup(consumerGroup.getConsumerGroup());
|
||||
vo.setAppIds("");
|
||||
vo.setLocation(consumerGroup.getOffsetStoreLocation().location);
|
||||
consumerGroupVOList.add(vo);
|
||||
}
|
||||
return consumerGroupVOList;
|
||||
}
|
||||
|
||||
public static List<ConsumerGroupSummaryVO> convert2ConsumerGroupSummaryVOList(List<ConsumerGroupSummary> summaryList) {
|
||||
if (ValidateUtils.isEmptyList(summaryList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ConsumerGroupSummaryVO> voList = new ArrayList<>();
|
||||
for (ConsumerGroupSummary consumerGroupSummary : summaryList) {
|
||||
ConsumerGroupSummaryVO vo = new ConsumerGroupSummaryVO();
|
||||
vo.setConsumerGroup(consumerGroupSummary.getConsumerGroup());
|
||||
vo.setAppIds(ListUtils.strList2String(consumerGroupSummary.getAppIdList()));
|
||||
vo.setLocation(consumerGroupSummary.getOffsetStoreLocation().location);
|
||||
vo.setState(consumerGroupSummary.getState());
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.xiaojukeji.kafka.manager.web.converters;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionAddGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionModifyGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.GatewayConfigDO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.KafkaAclDO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.KafkaUserDO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.gateway.KafkaAclVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.gateway.KafkaUserVO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.vo.rd.GatewayConfigVO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -49,4 +53,41 @@ public class GatewayModelConverter {
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public static List<GatewayConfigVO> convert2GatewayConfigVOList(List<GatewayConfigDO> doList) {
|
||||
if (ValidateUtils.isNull(doList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<GatewayConfigVO> voList = new ArrayList<>();
|
||||
for (GatewayConfigDO configDO: doList) {
|
||||
GatewayConfigVO vo = new GatewayConfigVO();
|
||||
vo.setId(configDO.getId());
|
||||
vo.setType(configDO.getType());
|
||||
vo.setName(configDO.getName());
|
||||
vo.setValue(configDO.getValue());
|
||||
vo.setVersion(configDO.getVersion());
|
||||
vo.setCreateTime(configDO.getCreateTime());
|
||||
vo.setModifyTime(configDO.getModifyTime());
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public static GatewayConfigDO convert2GatewayConfigDO(OrderExtensionAddGatewayConfigDTO configDTO) {
|
||||
GatewayConfigDO configDO = new GatewayConfigDO();
|
||||
configDO.setType(configDO.getType());
|
||||
configDO.setName(configDO.getName());
|
||||
configDO.setValue(configDO.getValue());
|
||||
return configDO;
|
||||
}
|
||||
|
||||
public static GatewayConfigDO convert2GatewayConfigDO(OrderExtensionModifyGatewayConfigDTO configDTO) {
|
||||
GatewayConfigDO configDO = new GatewayConfigDO();
|
||||
configDO.setId(configDO.getId());
|
||||
configDO.setType(configDO.getType());
|
||||
configDO.setName(configDO.getName());
|
||||
configDO.setValue(configDO.getValue());
|
||||
return configDO;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public class TopicModelConverter {
|
||||
vo.setTopicCodeC(dto.getTopicCodeC());
|
||||
vo.setDescription(dto.getDescription());
|
||||
vo.setBootstrapServers("");
|
||||
vo.setRegionNameList(dto.getRegionNameList());
|
||||
if (!ValidateUtils.isNull(clusterDO)) {
|
||||
vo.setBootstrapServers(clusterDO.getBootstrapServers());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user