diff --git a/eventmesh-admin-server/conf/eventmesh.sql b/eventmesh-admin-server/conf/eventmesh.sql
index 226101661c..82d5c53317 100644
--- a/eventmesh-admin-server/conf/eventmesh.sql
+++ b/eventmesh-admin-server/conf/eventmesh.sql
@@ -15,13 +15,6 @@
-- specific language governing permissions and limitations
-- under the License.
--- --------------------------------------------------------
--- 主机: 127.0.0.1
--- 服务器版本: 8.0.36 - MySQL Community Server - GPL
--- 服务器操作系统: Win64
--- HeidiSQL 版本: 11.3.0.6295
--- --------------------------------------------------------
-
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
@@ -30,103 +23,125 @@
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--- 导出 eventmesh 的数据库结构
+-- export eventmesh database
CREATE DATABASE IF NOT EXISTS `eventmesh` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `eventmesh`;
--- 导出 表 eventmesh.event_mesh_data_source 结构
+-- export table eventmesh.event_mesh_data_source structure
CREATE TABLE IF NOT EXISTS `event_mesh_data_source` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
- `dataType` int unsigned NOT NULL,
+ `dataType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`description` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`configuration` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `createUid` int NOT NULL,
- `updateUid` int NOT NULL,
+ `region` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-
--- 数据导出被取消选择。
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--- 导出 表 eventmesh.event_mesh_job_info 结构
+-- export table eventmesh.event_mesh_job_info structure
CREATE TABLE IF NOT EXISTS `event_mesh_job_info` (
- `jobID` int unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
- `transportType` int unsigned DEFAULT NULL COMMENT 'JobTransportType',
- `sourceData` int unsigned DEFAULT NULL COMMENT 'data_source表',
- `targetData` int unsigned DEFAULT NULL,
- `state` tinyint unsigned NOT NULL COMMENT 'JobState',
- `jobType` tinyint unsigned NOT NULL COMMENT 'connector,mesh,func,...',
- `createUid` int unsigned NOT NULL,
- `updateUid` int unsigned NOT NULL,
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `desc` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `taskID` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `transportType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `sourceData` int NOT NULL DEFAULT '0',
+ `targetData` int NOT NULL DEFAULT '0',
+ `state` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `jobType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `fromRegion` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `updateUid` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`jobID`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-
--- 数据导出被取消选择。
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE KEY `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--- 导出 表 eventmesh.event_mesh_mysql_position 结构
+-- export table eventmesh.event_mesh_mysql_position structure
CREATE TABLE IF NOT EXISTS `event_mesh_mysql_position` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
- `jobID` int unsigned NOT NULL,
+ `jobID` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`serverUUID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`position` bigint DEFAULT NULL,
`gtid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`currentGtid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`timestamp` bigint DEFAULT NULL,
- `journalName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `journalName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `jobID` (`jobID`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
-
--- 数据导出被取消选择。
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
--- 导出 表 eventmesh.event_mesh_position_reporter_history 结构
+-- export table eventmesh.event_mesh_position_reporter_history structure
CREATE TABLE IF NOT EXISTS `event_mesh_position_reporter_history` (
`id` bigint NOT NULL AUTO_INCREMENT,
- `job` int NOT NULL,
+ `job` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`record` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `address` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `job` (`job`),
KEY `address` (`address`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='记录position上报者变更时,老记录';
-
--- 数据导出被取消选择。
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='record position reporter changes';
--- 导出 表 eventmesh.event_mesh_runtime_heartbeat 结构
+-- export table eventmesh.event_mesh_runtime_heartbeat structure
CREATE TABLE IF NOT EXISTS `event_mesh_runtime_heartbeat` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`adminAddr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`runtimeAddr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `jobID` int unsigned DEFAULT NULL,
- `reportTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'runtime本地上报时间',
+ `jobID` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `reportTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'runtime local report time',
`updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `runtimeAddr` (`runtimeAddr`),
KEY `jobID` (`jobID`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-
--- 数据导出被取消选择。
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--- 导出 表 eventmesh.event_mesh_runtime_history 结构
+-- export table eventmesh.event_mesh_runtime_history structure
CREATE TABLE IF NOT EXISTS `event_mesh_runtime_history` (
`id` bigint NOT NULL AUTO_INCREMENT,
- `job` int NOT NULL,
+ `job` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `address` (`address`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='记录runtime上运行任务的变更';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='record runtime task change history';
--- 数据导出被取消选择。
+-- export table eventmesh.event_mesh_task_info structure
+CREATE TABLE IF NOT EXISTS `event_mesh_task_info` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `desc` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `state` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'taskstate',
+ `fromRegion` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `createUid` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE KEY `taskID` (`taskID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+-- export table eventmesh.event_mesh_verify structure
+CREATE TABLE IF NOT EXISTS `event_mesh_verify` (
+ `id` int NOT NULL,
+ `taskID` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `recordID` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `recordSig` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `connectorName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `connectorStage` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `position` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
index dee497c848..d100e19033 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
@@ -1,20 +1,23 @@
-
- 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.
- -->
@@ -22,18 +25,19 @@
-
+
-
-
+
+
+
- id,dataType,address,
- description,configuration,createUid,
- updateUid,createTime,updateTime
+ id,dataType,description,
+ configuration,region,createUid,updateUid,
+ createTime,updateTime
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
index e758a276a9..02e8806680 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
@@ -1,43 +1,49 @@
-
- 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.
- -->
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
- jobID,name,transportType,
- sourceData,targetData,state,
- runtimeType,createUid,
- updateUid,createTime,updateTime
+ id,jobID,desc,
+ taskID,transportType,sourceData,
+ targetData,state,jobType,
+ fromRegion,createTime,updateTime
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
index cbb7c094d8..9bcc7f42bb 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
@@ -1,43 +1,46 @@
-
- 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.
- -->
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
- id
- ,jobID,serverUUID,address,
- position,gtid,currentGtid,timestamp,journalName,
+ id,jobID,serverUUID,
+ address,position,gtid,
+ currentGtid,timestamp,journalName,
createTime,updateTime
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
index 2ee22e1ad9..a9e4fe6f1b 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
@@ -1,20 +1,23 @@
-
- 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.
- -->
@@ -22,7 +25,7 @@
-
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
index b811c5950d..200b1bf54a 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
@@ -1,20 +1,23 @@
-
- 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.
- -->
@@ -24,7 +27,7 @@
-
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
index d9e17bc859..281cce30f9 100644
--- a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
@@ -1,28 +1,31 @@
-
- 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.
- -->
-
-
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
new file mode 100644
index 0000000000..05b1dc52a0
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,name,
+ desc,state,fromRegion,
+ createUid,updateUid,createTime,
+ updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml
new file mode 100644
index 0000000000..b7b042145a
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,recordID,
+ recordSig,connectorName,connectorStage,
+ position,createTime
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
index 5a68baba1e..e68d05100f 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
@@ -19,9 +19,8 @@
import lombok.Getter;
+@Getter
public class AdminServerRuntimeException extends RuntimeException {
-
- @Getter
private final int code;
public AdminServerRuntimeException(int code, String message) {
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
index 7f5fa22dda..b179a790c5 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
@@ -23,7 +23,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-@SpringBootApplication()
+@SpringBootApplication(scanBasePackages = "org.apache.eventmesh.admin.server")
public class ExampleAdminServer {
public static void main(String[] args) throws Exception {
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
index 572e07a21d..d2a0330355 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
@@ -18,6 +18,7 @@
package org.apache.eventmesh.admin.server.web;
import org.apache.eventmesh.admin.server.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.service.AdminGrpcServer;
import java.util.concurrent.TimeUnit;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
index 3f91115bdc..bd896d546c 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
@@ -17,10 +17,30 @@
package org.apache.eventmesh.admin.server.web;
+import org.apache.eventmesh.admin.server.web.service.task.TaskBizService;
+import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/eventmesh/admin")
public class HttpServer {
+ @Autowired
+ private TaskBizService taskService;
+
+ @RequestMapping("/createTask")
+ public ResponseEntity> createOrUpdateTask(@RequestBody CreateTaskRequest task) {
+ String uuid = taskService.createTask(task);
+ return ResponseEntity.ok(Response.success(uuid));
+ }
+
+ public boolean deleteTask(Long id) {
+ return false;
+ }
+
+
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java
index d58312146c..329a00baae 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java
@@ -17,35 +17,44 @@
package org.apache.eventmesh.admin.server.web;
-public class Response {
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+public class Response {
+ private int code;
private boolean success;
private String desc;
private T data;
- public boolean isSuccess() {
- return success;
- }
-
- public void setSuccess(boolean success) {
- this.success = success;
- }
-
- public String getDesc() {
- return desc;
+ public static Response success() {
+ Response response = new Response<>();
+ response.success = true;
+ response.code = ErrorCode.SUCCESS;
+ return response;
}
- public void setDesc(String desc) {
- this.desc = desc;
+ public static Response success(T data) {
+ Response response = new Response<>();
+ response.success = true;
+ response.data = data;
+ return response;
}
- public T getData() {
- return data;
+ public static Response fail(int code, String desc) {
+ Response response = new Response<>();
+ response.success = false;
+ response.code = code;
+ response.desc = desc;
+ return response;
}
- public void setData(T data) {
- this.data = data;
+ public static Response fail(int code, String desc, T data) {
+ Response response = new Response<>();
+ response.success = false;
+ response.code = code;
+ response.desc = desc;
+ response.data = data;
+ return response;
}
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshDataSource.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshDataSource.java
index 2f154faf05..9d81366aa5 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshDataSource.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshDataSource.java
@@ -27,24 +27,25 @@
import lombok.Data;
/**
- * event_mesh_data_source
+ * TableName event_mesh_data_source
*/
@TableName(value = "event_mesh_data_source")
@Data
public class EventMeshDataSource implements Serializable {
-
@TableId(type = IdType.AUTO)
private Integer id;
- private Integer dataType;
+ private String dataType;
private String description;
private String configuration;
- private Integer createUid;
+ private String region;
+
+ private String createUid;
- private Integer updateUid;
+ private String updateUid;
private Date createTime;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java
index 73d2f4aba4..23db5f6c2b 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java
@@ -27,30 +27,35 @@
import lombok.Data;
/**
- * event_mesh_job_info
+ * TableName event_mesh_job_info
*/
@TableName(value = "event_mesh_job_info")
@Data
public class EventMeshJobInfo implements Serializable {
-
@TableId(type = IdType.AUTO)
- private Integer jobID;
+ private Integer id;
+
+ private String jobID;
- private String name;
+ private String desc;
- private Integer transportType;
+ private String taskID;
+
+ private String transportType;
private Integer sourceData;
private Integer targetData;
- private Integer state;
+ private String state;
+
+ private String jobType;
- private Integer jobType;
+ private String fromRegion;
- private Integer createUid;
+ private String createUid;
- private Integer updateUid;
+ private String updateUid;
private Date createTime;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java
index 65a38b54b5..5e5d5745c1 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java
@@ -27,16 +27,15 @@
import lombok.Data;
/**
- * event_mesh_mysql_position
+ * TableName event_mesh_mysql_position
*/
@TableName(value = "event_mesh_mysql_position")
@Data
public class EventMeshMysqlPosition implements Serializable {
-
@TableId(type = IdType.AUTO)
private Integer id;
- private Integer jobID;
+ private String jobID;
private String serverUUID;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java
index c8d7d9b6d0..8518c38918 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java
@@ -27,16 +27,15 @@
import lombok.Data;
/**
- * event_mesh_position_reporter_history
+ * TableName event_mesh_position_reporter_history
*/
@TableName(value = "event_mesh_position_reporter_history")
@Data
public class EventMeshPositionReporterHistory implements Serializable {
-
@TableId(type = IdType.AUTO)
private Long id;
- private Integer job;
+ private String job;
private String record;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java
index 7cc165cc58..95e6c5e261 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java
@@ -27,12 +27,11 @@
import lombok.Data;
/**
- * event_mesh_runtime_heartbeat
+ * TableName event_mesh_runtime_heartbeat
*/
@TableName(value = "event_mesh_runtime_heartbeat")
@Data
public class EventMeshRuntimeHeartbeat implements Serializable {
-
@TableId(type = IdType.AUTO)
private Long id;
@@ -40,7 +39,7 @@ public class EventMeshRuntimeHeartbeat implements Serializable {
private String runtimeAddr;
- private Integer jobID;
+ private String jobID;
private String reportTime;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java
index 1f8ef788d1..ea7e10cbad 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java
@@ -27,16 +27,15 @@
import lombok.Data;
/**
- * event_mesh_runtime_history
+ * TableName event_mesh_runtime_history
*/
@TableName(value = "event_mesh_runtime_history")
@Data
public class EventMeshRuntimeHistory implements Serializable {
-
@TableId(type = IdType.AUTO)
private Long id;
- private Integer job;
+ private String job;
private String address;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshTaskInfo.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshTaskInfo.java
new file mode 100644
index 0000000000..5d1b6648c9
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshTaskInfo.java
@@ -0,0 +1,57 @@
+/*
+ * 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.eventmesh.admin.server.web.db.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import lombok.Data;
+
+/**
+ * TableName event_mesh_task_info
+ */
+@TableName(value = "event_mesh_task_info")
+@Data
+public class EventMeshTaskInfo implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String taskID;
+
+ private String name;
+
+ private String desc;
+
+ private String state;
+
+ private String fromRegion;
+
+ private String createUid;
+
+ private String updateUid;
+
+ private Date createTime;
+
+ private Date updateTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshVerify.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshVerify.java
new file mode 100644
index 0000000000..5425c5c57b
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshVerify.java
@@ -0,0 +1,53 @@
+/*
+ * 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.eventmesh.admin.server.web.db.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import lombok.Data;
+
+/**
+ * TableName event_mesh_verify
+ */
+@TableName(value = "event_mesh_verify")
+@Data
+public class EventMeshVerify implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String taskID;
+
+ private String recordID;
+
+ private String recordSig;
+
+ private String connectorName;
+
+ private String connectorStage;
+
+ private String position;
+
+ private Date createTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoExtMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoExtMapper.java
new file mode 100644
index 0000000000..7f46dcab41
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoExtMapper.java
@@ -0,0 +1,44 @@
+/*
+ * 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.eventmesh.admin.server.web.db.mapper;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * etx operator for table event_mesh_job_info
+ */
+@Mapper
+public interface EventMeshJobInfoExtMapper extends BaseMapper {
+ @Insert("insert into event_mesh_job_info(`taskID`,`state`,`jobType`) values"
+ + "(#{job.taskID},#{job.state},#{job.jobType})")
+ @Options(useGeneratedKeys = true, keyProperty = "jobID")
+ int saveBatch(@Param("jobs") List jobInfoList);
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoMapper.java
index eb57c0af2c..39f8a4aed6 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoMapper.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoMapper.java
@@ -25,8 +25,7 @@
/**
* for table 'event_mesh_job_info' db operation
- * 2024-05-09 15:51:45
- * entity.db.web.server.admin.eventmesh.apache.org.EventMeshJobInfo
+ * entity org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo
*/
@Mapper
public interface EventMeshJobInfoMapper extends BaseMapper {
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.java
similarity index 65%
rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.java
index 7b0ae5074a..d1d472b8c4 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.java
@@ -15,17 +15,23 @@
* limitations under the License.
*/
-package org.apache.eventmesh.common.remote;
+package org.apache.eventmesh.admin.server.web.db.mapper;
-public enum JobState {
- INIT, STARTED, RUNNING, PAUSE, COMPLETE, DELETE, FAIL;
- private static final JobState[] STATES = JobState.values();
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
- public static JobState fromIndex(Integer index) {
- if (index == null || index < 0 || index >= STATES.length) {
- return null;
- }
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * event_mesh_task_info
+ * Entity org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo
+ */
+@Mapper
+public interface EventMeshTaskInfoMapper extends BaseMapper {
- return STATES[index];
- }
}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshVerifyMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshVerifyMapper.java
new file mode 100644
index 0000000000..b444d1e4b4
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshVerifyMapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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.eventmesh.admin.server.web.db.mapper;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshVerify;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * event_mesh_verify
+ * Entity org.apache.eventmesh.admin.server.web.db.entity.EventMeshVerify
+ */
+@Mapper
+public interface EventMeshVerifyMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/Task.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.java
similarity index 68%
rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/Task.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.java
index 6f97c4207c..22fc5ae299 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/Task.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.java
@@ -15,20 +15,15 @@
* limitations under the License.
*/
-package org.apache.eventmesh.common.remote;
+package org.apache.eventmesh.admin.server.web.db.service;
-// task : job = 1 : m
-public class Task {
- private long id;
- private String name;
- private String desc;
- private String uid;
- private String sourceUser;
- private String sourcePasswd;
- private String targetUser;
- private String targetPasswd;
- private int sourceType;
- private int targetType;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import java.util.List;
+/**
+ * ext operator for table event_mesh_job
+ */
+public interface EventMeshJobInfoExtService {
+ int batchSave(List jobs);
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoService.java
index c5ad399854..572e451ceb 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoService.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoService.java
@@ -22,8 +22,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
/**
-* for table `event_mesh_job_info' db operation
-* 2024-05-09 15:51:45
-*/
+ * event_mesh_job_info
+ */
public interface EventMeshJobInfoService extends IService {
+
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshTaskInfoService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshTaskInfoService.java
new file mode 100644
index 0000000000..dc35cfe071
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshTaskInfoService.java
@@ -0,0 +1,29 @@
+/*
+ * 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.eventmesh.admin.server.web.db.service;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * event_mesh_task_info
+ */
+public interface EventMeshTaskInfoService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java
new file mode 100644
index 0000000000..97f2d7268e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java
@@ -0,0 +1,29 @@
+/*
+ * 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.eventmesh.admin.server.web.db.service;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshVerify;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * event_mesh_verify
+ */
+public interface EventMeshVerifyService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/Admin.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java
similarity index 53%
rename from eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/Admin.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java
index 9ee25fadb2..6cf0ebf6b2 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/Admin.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java
@@ -15,32 +15,24 @@
* limitations under the License.
*/
-package org.apache.eventmesh.admin.server;
+package org.apache.eventmesh.admin.server.web.db.service.impl;
-import org.apache.eventmesh.common.ComponentLifeCycle;
-import org.apache.eventmesh.common.remote.Task;
-import org.apache.eventmesh.common.remote.request.ReportHeartBeatRequest;
-import org.apache.eventmesh.common.utils.PagedList;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshJobInfoExtMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoExtService;
-/**
- * Admin
- */
-public interface Admin extends ComponentLifeCycle {
-
- /**
- * support for web or ops
- **/
- boolean createOrUpdateTask(Task task);
-
- boolean deleteTask(Long id);
+import java.util.List;
- Task getTask(Long id);
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
- // paged list
- PagedList getTaskPaged(Task task);
+@Service
+public class EventMeshJobInfoExtServiceImpl implements EventMeshJobInfoExtService {
+ @Autowired
+ EventMeshJobInfoExtMapper mapper;
- /**
- * support for task
- */
- void reportHeartbeat(ReportHeartBeatRequest heartBeat);
+ @Override
+ public int batchSave(List jobs) {
+ return mapper.saveBatch(jobs);
+ }
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoServiceImpl.java
index dd7312ceae..4613e0809d 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoServiceImpl.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoServiceImpl.java
@@ -25,14 +25,10 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-
/**
- * for table 'event_mesh_job_info' db operation
- * 2024-05-09 15:51:45
+ * event_mesh_job_info
*/
@Service
-@Slf4j
public class EventMeshJobInfoServiceImpl extends ServiceImpl
implements EventMeshJobInfoService {
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshTaskInfoServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshTaskInfoServiceImpl.java
new file mode 100644
index 0000000000..9568b63671
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshTaskInfoServiceImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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.eventmesh.admin.server.web.db.service.impl;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshTaskInfoMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * event_mesh_task_info
+ */
+@Service
+public class EventMeshTaskInfoServiceImpl extends ServiceImpl
+ implements EventMeshTaskInfoService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchJobRequestHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchJobRequestHandler.java
index 56f9f047b7..8f159fa45b 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchJobRequestHandler.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchJobRequestHandler.java
@@ -17,14 +17,15 @@
package org.apache.eventmesh.admin.server.web.handler.impl;
-import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
-import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobDetail;
import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
-import org.apache.eventmesh.admin.server.web.service.job.EventMeshJobInfoBizService;
+import org.apache.eventmesh.admin.server.web.pojo.JobDetail;
+import org.apache.eventmesh.admin.server.web.service.job.JobInfoBizService;
import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.job.JobConnectorConfig;
import org.apache.eventmesh.common.remote.request.FetchJobRequest;
import org.apache.eventmesh.common.remote.response.FetchJobResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
import org.apache.commons.lang3.StringUtils;
@@ -38,34 +39,29 @@
public class FetchJobRequestHandler extends BaseRequestHandler {
@Autowired
- EventMeshJobInfoBizService jobInfoBizService;
+ JobInfoBizService jobInfoBizService;
@Override
public FetchJobResponse handler(FetchJobRequest request, Metadata metadata) {
if (StringUtils.isBlank(request.getJobID())) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, "job id is empty");
- }
- int jobID;
- try {
- jobID = Integer.parseInt(request.getJobID());
- } catch (NumberFormatException e) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, String.format("illegal job id %s",
- request.getJobID()));
+ return FetchJobResponse.failResponse(ErrorCode.BAD_REQUEST, "job id is empty");
}
FetchJobResponse response = FetchJobResponse.successResponse();
- EventMeshJobDetail detail = jobInfoBizService.getJobDetail(request, metadata);
+ JobDetail detail = jobInfoBizService.getJobDetail(request.getJobID());
if (detail == null) {
return response;
}
- response.setId(detail.getId());
- response.setName(detail.getName());
- response.setSourceConnectorConfig(detail.getSourceConnectorConfig());
- response.setSourceConnectorDesc(detail.getSourceConnectorDesc());
+ response.setId(detail.getJobID());
+ JobConnectorConfig config = new JobConnectorConfig();
+ config.setSourceConnectorConfig(JsonUtils.objectToMap(detail.getSourceDataSource()));
+ config.setSourceConnectorDesc(detail.getSourceConnectorDesc());
+ config.setSinkConnectorConfig(JsonUtils.objectToMap(detail.getSinkDataSource()));
+ config.setSourceConnectorDesc(detail.getSinkConnectorDesc());
+ response.setConnectorConfig(config);
response.setTransportType(detail.getTransportType());
- response.setSinkConnectorConfig(detail.getSinkConnectorConfig());
- response.setSourceConnectorDesc(detail.getSinkConnectorDesc());
response.setState(detail.getState());
- response.setPosition(detail.getPosition());
+ response.setPosition(detail.getPositions());
+ response.setType(detail.getJobType());
return response;
}
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchPositionHandler.java
index 2e6fa31f05..85ef0e6113 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchPositionHandler.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchPositionHandler.java
@@ -17,10 +17,9 @@
package org.apache.eventmesh.admin.server.web.handler.impl;
-import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
import org.apache.eventmesh.admin.server.web.db.DBThreadPool;
import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
-import org.apache.eventmesh.admin.server.web.service.position.EventMeshPositionBizService;
+import org.apache.eventmesh.admin.server.web.service.position.PositionBizService;
import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
import org.apache.eventmesh.common.remote.exception.ErrorCode;
import org.apache.eventmesh.common.remote.request.FetchPositionRequest;
@@ -41,15 +40,15 @@ public class FetchPositionHandler extends BaseRequestHandler {
+public class ReportHeartBeatHandler extends BaseRequestHandler {
@Autowired
- EventMeshRuntimeHeartbeatBizService heartbeatBizService;
+ RuntimeHeartbeatBizService heartbeatBizService;
@Autowired
DBThreadPool executor;
@Override
- protected EmptyAckResponse handler(ReportHeartBeatRequest request, Metadata metadata) {
+ protected SimpleResponse handler(ReportHeartBeatRequest request, Metadata metadata) {
+ if (StringUtils.isBlank(request.getJobID()) || StringUtils.isBlank(request.getAddress())) {
+ log.info("request [{}] id or reporter address is empty", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "request id or reporter address is empty");
+ }
executor.getExecutors().execute(() -> {
EventMeshRuntimeHeartbeat heartbeat = new EventMeshRuntimeHeartbeat();
- int job;
- try {
- job = Integer.parseInt(request.getJobID());
- } catch (NumberFormatException e) {
- log.warn("runtime {} report heartbeat fail, illegal job id {}", request.getAddress(), request.getJobID());
- return;
- }
- heartbeat.setJobID(job);
+ heartbeat.setJobID(request.getJobID());
heartbeat.setReportTime(request.getReportedTimeStamp());
heartbeat.setAdminAddr(IPUtils.getLocalAddress());
heartbeat.setRuntimeAddr(request.getAddress());
@@ -65,6 +65,6 @@ protected EmptyAckResponse handler(ReportHeartBeatRequest request, Metadata meta
}
});
- return new EmptyAckResponse();
+ return SimpleResponse.success();
}
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportPositionHandler.java
index adfe110134..5e2a968262 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportPositionHandler.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportPositionHandler.java
@@ -17,15 +17,15 @@
package org.apache.eventmesh.admin.server.web.handler.impl;
-import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
import org.apache.eventmesh.admin.server.web.db.DBThreadPool;
import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
-import org.apache.eventmesh.admin.server.web.service.job.EventMeshJobInfoBizService;
-import org.apache.eventmesh.admin.server.web.service.position.EventMeshPositionBizService;
+import org.apache.eventmesh.admin.server.web.pojo.JobDetail;
+import org.apache.eventmesh.admin.server.web.service.job.JobInfoBizService;
+import org.apache.eventmesh.admin.server.web.service.position.PositionBizService;
import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
import org.apache.eventmesh.common.remote.exception.ErrorCode;
import org.apache.eventmesh.common.remote.request.ReportPositionRequest;
-import org.apache.eventmesh.common.remote.response.EmptyAckResponse;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
import org.apache.commons.lang3.StringUtils;
@@ -36,36 +36,33 @@
@Component
@Slf4j
-public class ReportPositionHandler extends BaseRequestHandler {
-
+public class ReportPositionHandler extends BaseRequestHandler {
@Autowired
- EventMeshJobInfoBizService jobInfoBizService;
+ private JobInfoBizService jobInfoBizService;
@Autowired
- DBThreadPool executor;
+ private DBThreadPool executor;
@Autowired
- EventMeshPositionBizService positionBizService;
-
+ private PositionBizService positionBizService;
@Override
- protected EmptyAckResponse handler(ReportPositionRequest request, Metadata metadata) {
+ protected SimpleResponse handler(ReportPositionRequest request, Metadata metadata) {
+ if (StringUtils.isBlank(request.getJobID())) {
+ log.info("request [{}] illegal job id", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal job id, it's empty");
+ }
if (request.getDataSourceType() == null) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, "illegal data type, it's empty");
+ log.info("request [{}] illegal data type", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal data type, it's empty");
}
if (StringUtils.isBlank(request.getJobID())) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, "illegal job id, it's empty");
+ log.info("request [{}] illegal job id", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal job id, it's empty");
}
if (request.getRecordPositionList() == null || request.getRecordPositionList().isEmpty()) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, "illegal record position list, it's empty");
- }
- int jobID;
-
- try {
- jobID = Integer.parseInt(request.getJobID());
- } catch (NumberFormatException e) {
- throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, String.format("illegal job id [%s] format",
- request.getJobID()));
+ log.info("request [{}] illegal record position", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal record position list, it's empty");
}
positionBizService.isValidatePositionRequest(request.getDataSourceType());
@@ -88,8 +85,10 @@ protected EmptyAckResponse handler(ReportPositionRequest request, Metadata metad
log.warn("handle position request fail, request [{}]", request, e);
} finally {
try {
- if (!jobInfoBizService.updateJobState(jobID, request.getState())) {
- log.warn("update job [{}] state to [{}] fail", jobID, request.getState());
+ JobDetail detail = jobInfoBizService.getJobDetail(request.getJobID());
+ if (detail != null && !detail.getState().equals(request.getState()) && !jobInfoBizService.updateJobState(request.getJobID(),
+ request.getState())) {
+ log.warn("update job [{}] old state [{}] to [{}] fail", request.getJobID(), detail.getState(), request.getState());
}
} catch (Exception e) {
log.warn("update job id [{}] type [{}] state [{}] fail", request.getJobID(),
@@ -97,6 +96,6 @@ protected EmptyAckResponse handler(ReportPositionRequest request, Metadata metad
}
}
});
- return new EmptyAckResponse();
+ return SimpleResponse.success();
}
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportVerifyHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportVerifyHandler.java
new file mode 100644
index 0000000000..39963494cf
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportVerifyHandler.java
@@ -0,0 +1,49 @@
+/*
+ * 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.eventmesh.admin.server.web.handler.impl;
+
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.service.verify.VerifyBizService;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.request.ReportVerifyRequest;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+
+import org.apache.commons.lang3.StringUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class ReportVerifyHandler extends BaseRequestHandler {
+ @Autowired
+ private VerifyBizService verifyService;
+
+ @Override
+ protected SimpleResponse handler(ReportVerifyRequest request, Metadata metadata) {
+ if (StringUtils.isAnyBlank(request.getTaskID(), request.getRecordSig(), request.getRecordID(), request.getConnectorStage())) {
+ log.info("report verify request [{}] illegal", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "request task id, sign, record id or stage is none");
+ }
+ return verifyService.reportVerifyRecord(request) ? SimpleResponse.success() : SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "save verify "
+ + "request fail");
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/JobDetail.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/JobDetail.java
new file mode 100644
index 0000000000..c47b284483
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/JobDetail.java
@@ -0,0 +1,66 @@
+/*
+ * 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.eventmesh.admin.server.web.pojo;
+
+import org.apache.eventmesh.common.remote.TaskState;
+import org.apache.eventmesh.common.remote.TransportType;
+import org.apache.eventmesh.common.remote.datasource.DataSource;
+import org.apache.eventmesh.common.remote.job.JobType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.Date;
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class JobDetail {
+ private Integer id;
+
+ private String jobID;
+
+ private String desc;
+
+ private String taskID;
+
+ private TaskState state;
+
+ private JobType jobType;
+
+ private Date createTime;
+
+ private Date updateTime;
+
+ private String createUid;
+
+ private String updateUid;
+
+ private String region;
+
+ private DataSource sourceDataSource;
+
+ private String sourceConnectorDesc;
+
+ private DataSource sinkDataSource;
+
+ private String sinkConnectorDesc;
+
+ private TransportType transportType;
+
+ private List positions;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobType.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
similarity index 88%
rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobType.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
index 3c8272af40..86f5342f35 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobType.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.eventmesh.common.remote;
+package org.apache.eventmesh.admin.server.web.pojo;
-public enum JobType {
- FULL,
- INCREASE,
- STRUCT_SYNC
+/**
+ * Description:
+ */
+public class TaskDetail {
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/AdminGrpcServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java
similarity index 81%
rename from eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/AdminGrpcServer.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java
index 3bac237088..bc822ad6c3 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/AdminGrpcServer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.admin.server.web;
+package org.apache.eventmesh.admin.server.web.service;
import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
@@ -26,8 +26,7 @@
import org.apache.eventmesh.common.remote.payload.PayloadUtil;
import org.apache.eventmesh.common.remote.request.BaseRemoteRequest;
import org.apache.eventmesh.common.remote.response.BaseRemoteResponse;
-import org.apache.eventmesh.common.remote.response.EmptyAckResponse;
-import org.apache.eventmesh.common.remote.response.FailResponse;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
import org.apache.commons.lang3.StringUtils;
@@ -48,24 +47,26 @@ public class AdminGrpcServer extends AdminServiceGrpc.AdminServiceImplBase {
private Payload process(Payload value) {
if (value == null || StringUtils.isBlank(value.getMetadata().getType())) {
- return PayloadUtil.from(FailResponse.build(ErrorCode.BAD_REQUEST, "bad request: type not exists"));
+ return PayloadUtil.from(SimpleResponse.fail(ErrorCode.BAD_REQUEST, "bad request: type not exists"));
}
try {
BaseRequestHandler handler = handlerFactory.getHandler(value.getMetadata().getType());
if (handler == null) {
- return PayloadUtil.from(FailResponse.build(BaseRemoteResponse.UNKNOWN, "not match any request handler"));
+ return PayloadUtil.from(SimpleResponse.fail(ErrorCode.BAD_REQUEST, "not match any request handler"));
}
BaseRemoteResponse response = handler.handlerRequest((BaseRemoteRequest) PayloadUtil.parse(value), value.getMetadata());
- if (response == null || response instanceof EmptyAckResponse) {
- return null;
+ if (response == null) {
+ log.warn("received request type [{}] handler [{}], then replay empty response", value.getMetadata().getType(),
+ handler.getClass().getName());
+ response = SimpleResponse.success();
}
return PayloadUtil.from(response);
} catch (Exception e) {
log.warn("process payload {} fail", value.getMetadata().getType(), e);
if (e instanceof AdminServerRuntimeException) {
- return PayloadUtil.from(FailResponse.build(((AdminServerRuntimeException) e).getCode(), e.getMessage()));
+ return PayloadUtil.from(SimpleResponse.fail(((AdminServerRuntimeException) e).getCode(), e.getMessage()));
}
- return PayloadUtil.from(FailResponse.build(ErrorCode.INTERNAL_ERR, "admin server internal err"));
+ return PayloadUtil.from(SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "admin server internal err"));
}
}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java
similarity index 82%
rename from eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServer.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java
index a2e4cc7063..fd7582800d 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.apache.eventmesh.admin.server;
+package org.apache.eventmesh.admin.server.web.service;
+import org.apache.eventmesh.admin.server.AdminServerProperties;
+import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
+import org.apache.eventmesh.common.ComponentLifeCycle;
import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.config.CommonConfiguration;
import org.apache.eventmesh.common.config.ConfigService;
-import org.apache.eventmesh.common.remote.Task;
import org.apache.eventmesh.common.remote.exception.ErrorCode;
-import org.apache.eventmesh.common.remote.request.ReportHeartBeatRequest;
import org.apache.eventmesh.common.utils.IPUtils;
-import org.apache.eventmesh.common.utils.PagedList;
import org.apache.eventmesh.registry.RegisterServerInfo;
import org.apache.eventmesh.registry.RegistryFactory;
import org.apache.eventmesh.registry.RegistryService;
@@ -41,8 +41,7 @@
@Service
@Slf4j
-public class AdminServer implements Admin, ApplicationListener {
-
+public class AdminServer implements ComponentLifeCycle, ApplicationListener {
private final RegistryService registryService;
private final RegisterServerInfo adminServeInfo;
@@ -67,32 +66,6 @@ public AdminServer(AdminServerProperties properties) {
registryService = RegistryFactory.getInstance(configuration.getEventMeshRegistryPluginType());
}
-
- @Override
- public boolean createOrUpdateTask(Task task) {
- return false;
- }
-
- @Override
- public boolean deleteTask(Long id) {
- return false;
- }
-
- @Override
- public Task getTask(Long id) {
- return null;
- }
-
- @Override
- public PagedList getTaskPaged(Task task) {
- return null;
- }
-
- @Override
- public void reportHeartbeat(ReportHeartBeatRequest heartBeat) {
-
- }
-
@Override
@PostConstruct
public void start() {
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/datasource/DataSourceBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/datasource/DataSourceBizService.java
new file mode 100644
index 0000000000..433847a4cd
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/datasource/DataSourceBizService.java
@@ -0,0 +1,48 @@
+/*
+ * 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.eventmesh.admin.server.web.service.datasource;
+
+import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshDataSourceService;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.request.CreateOrUpdateDataSourceReq;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DataSourceBizService {
+ @Autowired
+ private EventMeshDataSourceService dataSourceService;
+
+ public EventMeshDataSource createDataSource(CreateOrUpdateDataSourceReq dataSource) {
+ EventMeshDataSource entity = new EventMeshDataSource();
+ entity.setConfiguration(JsonUtils.toJSONString(dataSource.getConfig()));
+ entity.setDataType(dataSource.getType().name());
+ entity.setCreateUid(dataSource.getOperator());
+ entity.setUpdateUid(dataSource.getOperator());
+ entity.setRegion(dataSource.getRegion());
+ entity.setDescription(dataSource.getDesc());
+ if (dataSourceService.save(entity)) {
+ return entity;
+ }
+ throw new AdminServerRuntimeException(ErrorCode.BAD_DB_DATA, "save data source fail");
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/EventMeshRuntimeHeartbeatBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/RuntimeHeartbeatBizService.java
similarity index 98%
rename from eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/EventMeshRuntimeHeartbeatBizService.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/RuntimeHeartbeatBizService.java
index 4fa80b270a..95dff6e5b3 100644
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/EventMeshRuntimeHeartbeatBizService.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/RuntimeHeartbeatBizService.java
@@ -34,7 +34,7 @@
*/
@Service
@Slf4j
-public class EventMeshRuntimeHeartbeatBizService {
+public class RuntimeHeartbeatBizService {
@Autowired
EventMeshRuntimeHistoryService historyService;
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/EventMeshJobInfoBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/EventMeshJobInfoBizService.java
deleted file mode 100644
index 79771cbf24..0000000000
--- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/EventMeshJobInfoBizService.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.eventmesh.admin.server.web.service.job;
-
-import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
-import org.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource;
-import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobDetail;
-import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
-import org.apache.eventmesh.admin.server.web.db.service.EventMeshDataSourceService;
-import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoService;
-import org.apache.eventmesh.admin.server.web.service.position.EventMeshPositionBizService;
-import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
-import org.apache.eventmesh.common.remote.JobState;
-import org.apache.eventmesh.common.remote.exception.ErrorCode;
-import org.apache.eventmesh.common.remote.job.DataSourceType;
-import org.apache.eventmesh.common.remote.job.JobTransportType;
-import org.apache.eventmesh.common.remote.request.FetchJobRequest;
-import org.apache.eventmesh.common.utils.JsonUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.fasterxml.jackson.core.type.TypeReference;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * for table 'event_mesh_job_info' db operation
- * 2024-05-09 15:51:45
- */
-@Service
-@Slf4j
-public class EventMeshJobInfoBizService {
-
- @Autowired
- EventMeshJobInfoService jobInfoService;
-
- @Autowired
- EventMeshDataSourceService dataSourceService;
-
- @Autowired
- EventMeshPositionBizService positionBizService;
-
- public boolean updateJobState(Integer jobID, JobState state) {
- if (jobID == null || state == null) {
- return false;
- }
- EventMeshJobInfo jobInfo = new EventMeshJobInfo();
- jobInfo.setJobID(jobID);
- jobInfo.setState(state.ordinal());
- jobInfoService.update(jobInfo, Wrappers.update().notIn("state", JobState.DELETE.ordinal(),
- JobState.COMPLETE.ordinal()));
- return true;
- }
-
- public EventMeshJobDetail getJobDetail(FetchJobRequest request, Metadata metadata) {
- if (request == null) {
- return null;
- }
- EventMeshJobInfo job = jobInfoService.getById(request.getJobID());
- if (job == null) {
- return null;
- }
- EventMeshJobDetail detail = new EventMeshJobDetail();
- detail.setId(job.getJobID());
- detail.setName(job.getName());
- EventMeshDataSource source = dataSourceService.getById(job.getSourceData());
- EventMeshDataSource target = dataSourceService.getById(job.getTargetData());
- if (source != null) {
- if (!StringUtils.isBlank(source.getConfiguration())) {
- try {
- detail.setSourceConnectorConfig(JsonUtils.parseTypeReferenceObject(source.getConfiguration(),
- new TypeReference