feat(web): 任务执行前判断pulsar topic和url是否匹配

This commit is contained in:
2024-01-22 16:45:07 +08:00
parent b7bdd25bdc
commit 123c79787c

View File

@@ -47,8 +47,14 @@ public class TaskController {
boolean scanQueue = StrUtil.contains(mode, "queue");
boolean scanLog = StrUtil.contains(mode, "log");
boolean scanBase = StrUtil.contains(mode, "base");
if (scanQueue && (StrUtil.isBlank(topic) || StrUtil.isBlank(pulsar))) {
throw new RuntimeException("Pulsar topic or url cannot be empty");
if (scanQueue) {
if (StrUtil.isBlank(topic) || StrUtil.isBlank(pulsar)) {
throw new RuntimeException("Pulsar topic or url cannot be empty");
} else {
if (!pulsarService.existsTopic(pulsar, topic)) {
throw new RuntimeException("Pulsar url is not contain the topic");
}
}
}
if ((scanLog || scanBase) && StrUtil.isBlank(hdfs)) {
throw new RuntimeException("Hdfs path cannot be empty");