You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/04/26 06:52:12 UTC

[incubator-inlong] branch master updated: [INLONG-3947][Manager] Support blank middleware (#3948)

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

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 92b73faa3 [INLONG-3947][Manager] Support blank middleware (#3948)
92b73faa3 is described below

commit 92b73faa3fd69ce79e02dea032b3043bb35490e4
Author: kipshi <48...@users.noreply.github.com>
AuthorDate: Tue Apr 26 14:52:06 2022 +0800

    [INLONG-3947][Manager] Support blank middleware (#3948)
---
 .../{TubeMiddleware.java => BlankMiddleware.java}  | 35 ++++++++--------------
 .../manager/service/core/mq/TubeMiddleware.java    | 16 +++++-----
 2 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/BlankMiddleware.java
similarity index 61%
copy from inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java
copy to inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/BlankMiddleware.java
index 4948e652d..fdc2c1bde 100644
--- a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java
+++ b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/BlankMiddleware.java
@@ -22,65 +22,54 @@ import org.apache.inlong.manager.common.enums.MQType;
 import org.apache.inlong.manager.common.pojo.group.InlongGroupInfo;
 import org.apache.inlong.manager.common.pojo.group.InlongGroupMqExtBase;
 import org.apache.inlong.manager.common.pojo.group.InlongGroupTopicResponse;
-import org.apache.inlong.manager.common.settings.InlongGroupSettings;
-import org.apache.inlong.manager.service.CommonOperateService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
- * TUBE MQ middleware implementation.
+ * BlankMiddleware is used when no message queue is needed
  */
 @Component
 @Slf4j
-public class TubeMiddleware implements Middleware {
-
-    @Autowired
-    private CommonOperateService commonOperateService;
+public class BlankMiddleware implements Middleware {
 
     @Override
     public MQType type() {
-        return MQType.TUBE;
+        return MQType.NONE;
     }
 
     @Override
     public int save(InlongGroupMqExtBase mqExtBaseInfo) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
 
     @Override
     public InlongGroupMqExtBase get(String groupId) {
-        log.error("There is no implementation about this mq type:{}", type());
-        return null;
+        InlongGroupMqExtBase mqExtBase = new InlongGroupMqExtBase();
+        mqExtBase.setMiddlewareType(MQType.NONE.getType());
+        mqExtBase.setInlongGroupId(groupId);
+        return mqExtBase;
     }
 
     @Override
     public int update(InlongGroupMqExtBase mqExtBaseInfo) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
 
     @Override
     public InlongGroupTopicResponse getTopic(InlongGroupInfo groupInfo) {
-        InlongGroupTopicResponse topicVO = new InlongGroupTopicResponse();
-        topicVO.setMqResourceObj(groupInfo.getMqResourceObj());
-        topicVO.setTubeMasterUrl(commonOperateService.getSpecifiedParam(InlongGroupSettings.TUBE_MASTER_URL));
-        topicVO.setInlongGroupId(groupInfo.getInlongGroupId());
-        topicVO.setMiddlewareType(type().name());
-        return topicVO;
+        log.error("There is no implementation about this mq type:{}", type());
+        return null;
     }
 
     @Override
     public InlongGroupInfo packSpecificInfo(InlongGroupInfo groupInfo) {
-        log.debug("begin to packing specific information about tube mq middleware.");
-        groupInfo.setTubeMaster(commonOperateService.getSpecifiedParam(InlongGroupSettings.TUBE_MASTER_URL));
         return groupInfo;
     }
 
     @Override
     public int delete(String groupId) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
-    
 }
diff --git a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java
index 4948e652d..5533d354b 100644
--- a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java
+++ b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/mq/TubeMiddleware.java
@@ -44,19 +44,21 @@ public class TubeMiddleware implements Middleware {
 
     @Override
     public int save(InlongGroupMqExtBase mqExtBaseInfo) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
 
     @Override
     public InlongGroupMqExtBase get(String groupId) {
-        log.error("There is no implementation about this mq type:{}", type());
-        return null;
+        InlongGroupMqExtBase mqExtBase = new InlongGroupMqExtBase();
+        mqExtBase.setMiddlewareType(MQType.TUBE.getType());
+        mqExtBase.setInlongGroupId(groupId);
+        return mqExtBase;
     }
 
     @Override
     public int update(InlongGroupMqExtBase mqExtBaseInfo) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
 
@@ -72,15 +74,15 @@ public class TubeMiddleware implements Middleware {
 
     @Override
     public InlongGroupInfo packSpecificInfo(InlongGroupInfo groupInfo) {
-        log.debug("begin to packing specific information about tube mq middleware.");
+        log.warn("begin to packing specific information about tube mq middleware.");
         groupInfo.setTubeMaster(commonOperateService.getSpecifiedParam(InlongGroupSettings.TUBE_MASTER_URL));
         return groupInfo;
     }
 
     @Override
     public int delete(String groupId) {
-        log.error("There is no implementation about this mq type:{}", type());
+        log.warn("There is no implementation about this mq type:{}", type());
         return -1;
     }
-    
+
 }