[agent][executor]- 优化command executor的代码
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.wdd.common.beans.executor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.wdd.common.utils.TimeUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -15,26 +16,59 @@ import java.util.List;
|
||||
@SuperBuilder(toBuilder = true)
|
||||
public class ExecutionMessage {
|
||||
|
||||
/**
|
||||
* 2023年2月22日
|
||||
* 是否需要返回 命令行的处理调用结果
|
||||
* 通过 MQ返回
|
||||
*/
|
||||
@JsonProperty(defaultValue = "false")
|
||||
boolean needResultReplay;
|
||||
|
||||
/**
|
||||
* 2023年2月22日
|
||||
* 是否是长时间持续执行任务
|
||||
*/
|
||||
@JsonProperty(defaultValue = "false")
|
||||
boolean durationTask;
|
||||
|
||||
/**
|
||||
* 用于区分 ExecutionMessage的类型
|
||||
* 直接执行预定函数,则为 Nacos配置中的 方法名称,例如 AgentUpdate AgentReboot
|
||||
*/
|
||||
private String type;
|
||||
|
||||
private List<String> commandList;
|
||||
|
||||
/**
|
||||
* 只有一行的命令行
|
||||
*/
|
||||
private List<String> singleLineCommand;
|
||||
/**
|
||||
* add in 2023-1-17
|
||||
* 页面定时脚本任务 需要传递完整的命令列表
|
||||
*/
|
||||
private List<List<String>> scriptCommandList;
|
||||
private List<List<String>> multiLineCommand;
|
||||
|
||||
/**
|
||||
* 词条执行命令的返回结果在Redis中的ResultKey
|
||||
*/
|
||||
private String resultKey;
|
||||
|
||||
/**
|
||||
* 生成 Command结果的 resultKey
|
||||
*
|
||||
* @param topicName
|
||||
* @return
|
||||
*/
|
||||
public static String GetResultKey(String topicName) {
|
||||
return topicName + "-Execution:" + TimeUtils.currentTimeStringFullSplit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟执行任务,执行的Key为未来的,生成这个和Key
|
||||
*
|
||||
* @param topicName
|
||||
* @param futureExecutionTime
|
||||
* @return
|
||||
*/
|
||||
public static String GetFutureResultKey(String topicName, LocalDateTime futureExecutionTime) {
|
||||
return topicName + "-Execution:" + TimeUtils.localDateTimeString(futureExecutionTime);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.experimental.SuperBuilder;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SuperBuilder(toBuilder = true)
|
||||
@Deprecated
|
||||
public class ExecutorFunctionMessage {
|
||||
|
||||
String functionName;
|
||||
|
||||
Reference in New Issue
Block a user