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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7ab58db055 [INLONG-9844][Agent] Add agent installer config request 
class (#9845)
7ab58db055 is described below

commit 7ab58db0557af78cde4f112e49488a5889297ce3
Author: justinwwhuang <[email protected]>
AuthorDate: Wed Mar 20 10:21:44 2024 +0800

    [INLONG-9844][Agent] Add agent installer config request class (#9845)
---
 .../inlong/agent/installer/ManagerFetcher.java     | 19 ++++++------
 .../inlong/agent/installer/ModuleManager.java      |  4 +++
 .../common/pojo/agent/installer/ConfigRequest.java | 35 ++++++++++++++++++++++
 .../common/pojo/agent/installer/ModuleConfig.java  |  7 +++--
 4 files changed, 52 insertions(+), 13 deletions(-)

diff --git 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ManagerFetcher.java
 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ManagerFetcher.java
index 15475a81df..9e7832a6ac 100644
--- 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ManagerFetcher.java
+++ 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ManagerFetcher.java
@@ -23,9 +23,7 @@ import 
org.apache.inlong.agent.installer.conf.InstallerConfiguration;
 import org.apache.inlong.agent.utils.AgentUtils;
 import org.apache.inlong.agent.utils.HttpManager;
 import org.apache.inlong.agent.utils.ThreadUtils;
-import org.apache.inlong.common.db.CommandEntity;
-import org.apache.inlong.common.enums.PullJobTypeEnum;
-import org.apache.inlong.common.pojo.agent.TaskRequest;
+import org.apache.inlong.common.pojo.agent.installer.ConfigRequest;
 import org.apache.inlong.common.pojo.agent.installer.ConfigResult;
 import org.apache.inlong.common.pojo.agent.installer.ModuleConfig;
 import org.apache.inlong.common.pojo.agent.installer.PackageConfig;
@@ -74,6 +72,7 @@ public class ManagerFetcher extends AbstractDaemon implements 
ProfileFetcher {
     private final Manager manager;
     private String localIp;
     private String uuid;
+    private String clusterTag;
     private String clusterName;
 
     public ManagerFetcher(Manager manager) {
@@ -90,6 +89,7 @@ public class ManagerFetcher extends AbstractDaemon implements 
ProfileFetcher {
             httpManager = new HttpManager(managerAddr, managerHttpPrefixPath, 
timeout, secretId, secretKey);
             baseManagerUrl = httpManager.getBaseUrl();
             staticConfigUrl = buildStaticConfigUrl(baseManagerUrl);
+            clusterTag = conf.get(CLUSTER_TAG);
             clusterName = conf.get(CLUSTER_NAME);
         } else {
             throw new RuntimeException("init manager error, cannot find 
required key");
@@ -114,7 +114,7 @@ public class ManagerFetcher extends AbstractDaemon 
implements ProfileFetcher {
      */
     public ConfigResult getConfig() {
         LOGGER.info("getConfig start");
-        String resultStr = httpManager.doSentPost(staticConfigUrl, 
getFetchRequest(null));
+        String resultStr = httpManager.doSentPost(staticConfigUrl, 
getFetchRequest());
         LOGGER.info("ConfigUrl {}", staticConfigUrl);
         JsonObject resultData = getResultData(resultStr);
         JsonElement dataElement = 
resultData.get(AGENT_MANAGER_RETURN_PARAM_DATA);
@@ -131,13 +131,12 @@ public class ManagerFetcher extends AbstractDaemon 
implements ProfileFetcher {
     /**
      * Form file command fetch request
      */
-    public TaskRequest getFetchRequest(List<CommandEntity> unackedCommands) {
-        TaskRequest request = new TaskRequest();
-        request.setAgentIp(localIp);
-        request.setUuid(uuid);
+    public ConfigRequest getFetchRequest() {
+        ConfigRequest request = new ConfigRequest();
+        request.setClusterTag(clusterTag);
         request.setClusterName(clusterName);
-        request.setPullJobType(PullJobTypeEnum.NEW.getType());
-        request.setCommandInfo(unackedCommands);
+        request.setLocalIp(localIp);
+        request.setMd5(manager.getModuleManager().getCurrentMd5());
         return request;
     }
 
diff --git 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
index 7f716416a1..5b4a89fdfb 100755
--- 
a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
+++ 
b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java
@@ -63,6 +63,10 @@ public class ModuleManager extends AbstractDaemon {
         configQueue.add(config);
     }
 
+    public String getCurrentMd5() {
+        return currentMd5;
+    }
+
     /**
      * thread for core thread.
      *
diff --git 
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ConfigRequest.java
 
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ConfigRequest.java
new file mode 100644
index 0000000000..f4cfa3c1e4
--- /dev/null
+++ 
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ConfigRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.common.pojo.agent.installer;
+
+import lombok.Data;
+
+/**
+ * Request config from installer to manager.
+ */
+@Data
+public class ConfigRequest {
+
+    private String clusterTag;
+
+    private String clusterName;
+
+    private String localIp;
+
+    private String md5;
+}
diff --git 
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
 
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
index c059cb997d..c24583c152 100644
--- 
a/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
+++ 
b/inlong-common/src/main/java/org/apache/inlong/common/pojo/agent/installer/ModuleConfig.java
@@ -62,11 +62,12 @@ public class ModuleConfig {
      * The command to uninstall the module
      */
     private String uninstallCommand;
-
+    /**
+     * Installation package config
+     */
     private PackageConfig packageConfig;
-
     /**
-     * The state of the module
+     * The state of the module,identify that the module is in a state of 
addition, download, installation, etc
      */
     private ModuleStateEnum state;
 }
\ No newline at end of file

Reply via email to