From 9b269b3c537408cedf45f4cd014d5f6733a42ce7 Mon Sep 17 00:00:00 2001 From: Wenjun Ruan Date: Sat, 1 Apr 2023 10:45:21 +0800 Subject: [PATCH] Use common response for sync request (#13847) --- .../processor/TaskKillResponseProcessor.java | 2 +- .../TaskKillResponseProcessorTest.java | 2 +- .../remote/command/MessageType.java | 29 ++----------------- .../command/alert/AlertSendResponse.java | 2 +- .../remote/command/log/GetAppIdResponse.java | 2 +- .../command/log/GetLogBytesResponse.java | 2 +- .../command/log/RemoveTaskLogResponse.java | 2 +- .../command/log/RollViewLogResponse.java | 2 +- .../command/log/ViewLogResponseResponse.java | 2 +- .../remote/command/task/TaskKillResponse.java | 2 +- .../command/task/TaskSavePointResponse.java | 2 +- .../task/WorkflowHostChangeResponse.java | 2 +- .../WorkflowExecutingDataResponse.java | 2 +- .../command/alert/AlertSendResponseTest.java | 2 +- 14 files changed, 15 insertions(+), 40 deletions(-) diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessor.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessor.java index c2c5b73ab2..7b88626665 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessor.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessor.java @@ -52,7 +52,7 @@ public class TaskKillResponseProcessor implements NettyRequestProcessor { @Override public MessageType getCommandType() { - return MessageType.TASK_KILL_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.java b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.java index 6e94bcd8ac..b3280885a1 100644 --- a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.java +++ b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/TaskKillResponseProcessorTest.java @@ -64,7 +64,7 @@ public class TaskKillResponseProcessorTest { @Test public void testProcess() { Message message = taskKillResponse.convert2Command(1); - Assertions.assertEquals(MessageType.TASK_KILL_RESPONSE, message.getType()); + Assertions.assertEquals(MessageType.RESPONSE, message.getType()); taskKillResponseProcessor.process(channel, message); } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/MessageType.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/MessageType.java index 7c432a11e7..636daa0913 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/MessageType.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/MessageType.java @@ -19,28 +19,18 @@ package org.apache.dolphinscheduler.remote.command; public enum MessageType { + RESPONSE, + GET_APP_ID_REQUEST, - GET_APP_ID_RESPONSE, REMOVE_TAK_LOG_REQUEST, - REMOVE_TAK_LOG_RESPONSE, - ROLL_VIEW_LOG_REQUEST, - ROLL_VIEW_LOG_RESPONSE, - VIEW_WHOLE_LOG_REQUEST, - VIEW_WHOLE_LOG_RESPONSE, - GET_LOG_BYTES_REQUEST, - GET_LOG_BYTES_RESPONSE, - - WORKER_REQUEST, - MASTER_RESPONSE, - /** * task execute start, from api to master */ @@ -73,8 +63,6 @@ public enum MessageType { TASK_KILL_REQUEST, - TASK_KILL_RESPONSE, - TASK_REJECT, TASK_REJECT_MESSAGE_ACK, @@ -84,11 +72,6 @@ public enum MessageType { */ TASK_SAVEPOINT_REQUEST, - /** - * task savepoint ack, for stream task - */ - TASK_SAVEPOINT_RESPONSE, - HEART_BEAT, PING, @@ -97,10 +80,7 @@ public enum MessageType { ALERT_SEND_REQUEST, - ALERT_SEND_RESPONSE, - WORKFLOW_HOST_CHANGE_REQUEST, - WORKFLOW_HOST_CHANGE_RESPONSE, /** * state event request @@ -134,10 +114,5 @@ public enum MessageType { */ TASK_UPDATE_PID__MESSAGE_ACK, - /** - * workflow executing data response, from master to api - */ - WORKFLOW_EXECUTING_DATA_RESPONSE, - WORKFLOW_METRICS_CLEANUP; } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponse.java index 452bef5a00..0f07a5c240 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponse.java @@ -42,7 +42,7 @@ public class AlertSendResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.ALERT_SEND_RESPONSE; + return MessageType.RESPONSE; } @Data diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetAppIdResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetAppIdResponse.java index c4f8afa6f0..b989627f4a 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetAppIdResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetAppIdResponse.java @@ -35,6 +35,6 @@ public class GetAppIdResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.GET_APP_ID_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetLogBytesResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetLogBytesResponse.java index 03335ecd95..b051a8e9f6 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetLogBytesResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/GetLogBytesResponse.java @@ -39,7 +39,7 @@ public class GetLogBytesResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.GET_LOG_BYTES_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RemoveTaskLogResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RemoveTaskLogResponse.java index 332f845796..6884a06fad 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RemoveTaskLogResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RemoveTaskLogResponse.java @@ -39,6 +39,6 @@ public class RemoveTaskLogResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.REMOVE_TAK_LOG_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RollViewLogResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RollViewLogResponse.java index afd05c85a5..30cc8bc895 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RollViewLogResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/RollViewLogResponse.java @@ -39,6 +39,6 @@ public class RollViewLogResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.ROLL_VIEW_LOG_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/ViewLogResponseResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/ViewLogResponseResponse.java index cedc6a549a..9366133816 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/ViewLogResponseResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/log/ViewLogResponseResponse.java @@ -39,6 +39,6 @@ public class ViewLogResponseResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.VIEW_WHOLE_LOG_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskKillResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskKillResponse.java index e99d6c56d5..9ef2bf5312 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskKillResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskKillResponse.java @@ -52,6 +52,6 @@ public class TaskKillResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.TASK_KILL_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskSavePointResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskSavePointResponse.java index 9e992787ee..32b8293665 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskSavePointResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/TaskSavePointResponse.java @@ -39,6 +39,6 @@ public class TaskSavePointResponse implements RequestMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.TASK_SAVEPOINT_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/WorkflowHostChangeResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/WorkflowHostChangeResponse.java index 16acf034cd..44b78d186f 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/WorkflowHostChangeResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/task/WorkflowHostChangeResponse.java @@ -45,6 +45,6 @@ public class WorkflowHostChangeResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.WORKFLOW_HOST_CHANGE_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/workflow/WorkflowExecutingDataResponse.java b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/workflow/WorkflowExecutingDataResponse.java index adc8a6633a..ef0f4084b2 100644 --- a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/workflow/WorkflowExecutingDataResponse.java +++ b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/command/workflow/WorkflowExecutingDataResponse.java @@ -37,6 +37,6 @@ public class WorkflowExecutingDataResponse implements ResponseMessageBuilder { @Override public MessageType getCommandType() { - return MessageType.WORKFLOW_EXECUTING_DATA_RESPONSE; + return MessageType.RESPONSE; } } diff --git a/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponseTest.java b/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponseTest.java index 41cdfbf957..cd6fab8421 100644 --- a/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponseTest.java +++ b/dolphinscheduler-remote/src/test/java/org/apache/dolphinscheduler/remote/command/alert/AlertSendResponseTest.java @@ -44,6 +44,6 @@ public class AlertSendResponseTest { alertSendResponse.setResResults(responseResults); Message message = alertSendResponse.convert2Command(1); - Assertions.assertEquals(MessageType.ALERT_SEND_RESPONSE, message.getType()); + Assertions.assertEquals(MessageType.RESPONSE, message.getType()); } }