This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch TUBEMQ-421
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git


The following commit(s) were added to refs/heads/TUBEMQ-421 by this push:
     new eee5615  [TUBEMQ-488] reorg topic operation including batch delete / 
query / modify
eee5615 is described below

commit eee56150d88e0a6205faaa95db94a770b7461e13
Author: EMsnap <[email protected]>
AuthorDate: Tue Dec 29 19:36:47 2020 +0800

    [TUBEMQ-488] reorg topic operation including batch delete / query / modify
---
 .../controller/topic/TopicWebController.java       | 83 +++++++++++++++++++---
 1 file changed, 74 insertions(+), 9 deletions(-)

diff --git 
a/tubemq-manager/src/main/java/org/apache/tubemq/manager/controller/topic/TopicWebController.java
 
b/tubemq-manager/src/main/java/org/apache/tubemq/manager/controller/topic/TopicWebController.java
index 005ab9a..dd9cd52 100644
--- 
a/tubemq-manager/src/main/java/org/apache/tubemq/manager/controller/topic/TopicWebController.java
+++ 
b/tubemq-manager/src/main/java/org/apache/tubemq/manager/controller/topic/TopicWebController.java
@@ -18,30 +18,26 @@
 
 package org.apache.tubemq.manager.controller.topic;
 
+import static org.apache.tubemq.manager.utils.MasterUtils.queryMaster;
+
 import com.google.gson.Gson;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
+import java.util.Map;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.tubemq.manager.controller.TubeMQResult;
 import org.apache.tubemq.manager.controller.node.request.BatchAddTopicReq;
 import org.apache.tubemq.manager.controller.node.request.CloneTopicReq;
 import org.apache.tubemq.manager.entry.NodeEntry;
-import org.apache.tubemq.manager.entry.TopicEntry;
-import org.apache.tubemq.manager.entry.TopicStatus;
-import org.apache.tubemq.manager.exceptions.TubeMQManagerException;
 import org.apache.tubemq.manager.repository.NodeRepository;
 import org.apache.tubemq.manager.repository.TopicRepository;
 import org.apache.tubemq.manager.service.NodeService;
 import org.apache.tubemq.manager.service.TopicBackendWorker;
-import org.apache.tubemq.manager.service.TopicFuture;
+import org.apache.tubemq.manager.utils.MasterUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController
@@ -63,6 +59,9 @@ public class TopicWebController {
 
     public Gson gson = new Gson();
 
+    @Autowired
+    private MasterUtils masterUtils;
+
     /**
      * add topic to brokers
      * @param req
@@ -97,4 +96,70 @@ public class TopicWebController {
         return nodeService.cloneTopicToBrokers(req, masterEntry);
     }
 
+    /**
+     * batch modify topic config
+     * @param req
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/modify")
+    public @ResponseBody String modifyTopics(
+        @RequestParam Map<String, String> req) throws Exception {
+        String url = masterUtils.getQueryUrl(req);
+        return queryMaster(url);
+    }
+
+    /**
+     * batch delete topic info
+     * @param req
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/delete")
+    public @ResponseBody String deleteTopics(
+        @RequestParam Map<String, String> req) throws Exception {
+        String url = masterUtils.getQueryUrl(req);
+        return queryMaster(url);
+    }
+
+
+    /**
+     * batch remove topics
+     * @param req
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/remove")
+    public @ResponseBody String removeTopics(
+        @RequestParam Map<String, String> req) throws Exception {
+        String url = masterUtils.getQueryUrl(req);
+        return queryMaster(url);
+    }
+
+    /**
+     * query consumer auth control, shows all consumer groups
+     * @param req
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/query/consumer-auth")
+    public @ResponseBody String queryConsumerAuth(
+        @RequestParam Map<String, String> req) throws Exception {
+        String url = masterUtils.getQueryUrl(req);
+        return queryMaster(url);
+    }
+
+    /**
+     * query topic config info
+     * @param req
+     * @return
+     * @throws Exception
+     */
+    public @ResponseBody String queryTopicConfig(
+        @RequestParam Map<String, String> req) throws Exception {
+        String url = masterUtils.getQueryUrl(req);
+        return queryMaster(url);
+    }
+
+
 }

Reply via email to