mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-03 19:38:20 +08:00
删除topic
This commit is contained in:
@@ -111,4 +111,9 @@ public interface TopicService {
|
|||||||
* 创建topic
|
* 创建topic
|
||||||
*/
|
*/
|
||||||
Result addTopic(TopicAddDTO dto);
|
Result addTopic(TopicAddDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除topic
|
||||||
|
*/
|
||||||
|
Result deleteTopic(Long clusterId, String topicName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -874,6 +874,20 @@ public class TopicServiceImpl implements TopicService {
|
|||||||
return Result.buildFrom(rs);
|
return Result.buildFrom(rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result deleteTopic(Long clusterId, String topicName) {
|
||||||
|
Long physicalClusterId = logicalClusterMetadataManager.getPhysicalClusterId(clusterId);
|
||||||
|
if (ValidateUtils.isNull(physicalClusterId)) {
|
||||||
|
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
ClusterDO clusterDO = clusterService.getById(physicalClusterId);
|
||||||
|
if (ValidateUtils.isNull(clusterDO)) {
|
||||||
|
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
ResultStatus rs = adminService.deleteTopic(clusterDO, topicName, SpringTool.getUserName());
|
||||||
|
return Result.buildFrom(rs);
|
||||||
|
}
|
||||||
|
|
||||||
private Result<TopicOffsetChangedEnum> checkTopicOffsetChanged(ClusterDO clusterDO,
|
private Result<TopicOffsetChangedEnum> checkTopicOffsetChanged(ClusterDO clusterDO,
|
||||||
String topicName,
|
String topicName,
|
||||||
Map<TopicPartition, Long> endOffsetMap) {
|
Map<TopicPartition, Long> endOffsetMap) {
|
||||||
|
|||||||
@@ -350,4 +350,14 @@ public class NormalTopicController {
|
|||||||
return topicService.addTopic(dto);
|
return topicService.addTopic(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除topic",notes = "删除topic")
|
||||||
|
@RequestMapping(value = {"{clusterId}/topics/{topicName}/delete"},method = RequestMethod.DELETE)
|
||||||
|
@ResponseBody
|
||||||
|
public Result deleteTopic(@PathVariable Long clusterId,
|
||||||
|
@PathVariable String topicName) {
|
||||||
|
if (ValidateUtils.isNull(clusterId) || ValidateUtils.isNull(topicName)) {
|
||||||
|
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||||
|
}
|
||||||
|
return topicService.deleteTopic(clusterId,topicName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user