You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/02/26 06:33:53 UTC

[GitHub] [incubator-inlong] dockerzhang commented on a change in pull request #2740: [INLONG-2677][Manager] Get MQ cluster from database, remove local file configuration dependency

dockerzhang commented on a change in pull request #2740:
URL: https://github.com/apache/incubator-inlong/pull/2740#discussion_r815276237



##########
File path: inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/CommonOperateService.java
##########
@@ -41,6 +51,77 @@
     @Autowired
     private InlongGroupEntityMapper groupMapper;
 
+    @Autowired
+    private DataProxyClusterEntityMapper dataProxyClusterMapper;
+
+    @Autowired
+    private ThirdPartyClusterEntityMapper thirdPartyClusterMapper;
+
+    /**
+     * query some third-party-cluster info according key, such as "pulsar_adminUrl", "cluster_tube_manager", etc.
+     *
+     * @param key
+     * @return the value of key in database
+     */
+    public String getSpecifiedParam(String key) {
+        String result = "";
+        ThirdPartyClusterEntity clusterEntity;
+        Gson gson = new Gson();
+        Map<String, String> params;
+
+        switch (key) {
+            case Constant.PULSAR_ADMINURL:
+            case Constant.PULSAR_SERVICEURL: {
+                clusterEntity = getThirdPartyCluster(Constant.MIDDLEWARE_PULSAR);
+                if (clusterEntity != null) {
+                    params = gson.fromJson(clusterEntity.getExtParams(), Map.class);
+                    result = params.get(key);
+                }
+                break;
+            }
+            case Constant.CLUSTER_TUBE_MANAGER:
+            case Constant.CLUSTER_TUBE_CLUSTER_ID:
+            case Constant.TUBE_MASTER_URL: {
+                clusterEntity = getThirdPartyCluster(Constant.MIDDLEWARE_TUBE);
+                if (clusterEntity != null) {
+                    if (key.equals(Constant.TUBE_MASTER_URL)) {
+                        result = clusterEntity.getUrl();
+                    } else {
+                        params = gson.fromJson(clusterEntity.getExtParams(), Map.class);
+                        result = params.get(key);
+                    }
+                }
+                break;
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * @param type third-party-cluster type, such as TUBE, PULSAR, ZOOKEEPER, SORT

Review comment:
       remove ZOOKEEPER and SORT




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org