diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index b4b1d8e39d..508014de35 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -21,18 +21,23 @@ updates:
directory: "/"
open-pull-requests-limit: 15
schedule:
- interval: "weekly"
+ interval: "monthly"
ignore:
- dependency-name: "*"
- update-types: [ "version-update:semver-major" ]
+ update-types: [ "version-update:semver-major", "version-update:semver-patch" ]
+ - dependency-name: "software.amazon.awssdk:s3"
+ update-types: [ "version-update:semver-patch" ]
+ - dependency-name: "com.aliyun:dingtalk"
+ update-types: [ "version-update:semver-patch" ]
- package-ecosystem: "gomod"
directory: "eventmesh-sdks/eventmesh-sdk-go"
+ # Disabled temporarily since the Go SDK is not integrated with CI
+ open-pull-requests-limit: 0
schedule:
interval: "monthly"
ignore:
- dependency-name: "*"
- # Disabled temporarily since the Go SDK is not integrated with CI
- update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
+ update-types: [ "version-update:semver-major", "version-update:semver-patch" ]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
diff --git a/.github/workflows/auto-dependabot.yml b/.github/workflows/auto-dependabot.yml
index 0d43a05866..512a43f6ec 100644
--- a/.github/workflows/auto-dependabot.yml
+++ b/.github/workflows/auto-dependabot.yml
@@ -27,7 +27,7 @@ jobs:
# Pull request Auto merge is not enabled for this repository
dependabot:
runs-on: ubuntu-latest
- if: github.actor == 'dependabot[bot]'
+ if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ce5eae95b7..d63c381107 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,16 +39,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
+ with:
+ submodules: true
- - if: matrix.language == 'cpp' || matrix.language == 'csharp'
- name: Build C
- run: |
- git submodule init
- git submodule update
- make -C ./eventmesh-sdks/eventmesh-sdk-c
+ - name: Build C SDK
+ if: matrix.language == 'cpp'
+ run: make -C ./eventmesh-sdks/eventmesh-sdk-c
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v3
+ uses: gradle/actions/setup-gradle@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
@@ -59,7 +58,7 @@ jobs:
- name: GenerateGrammarSource
run: ./gradlew clean generateGrammarSource --parallel --daemon --scan
env:
- GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
@@ -69,14 +68,16 @@ jobs:
# https://docs.gradle.org/current/userguide/performance.html
- name: Build
- run: ./gradlew clean build dist jacocoTestReport -x spotlessJava -x generateGrammarSource --parallel --daemon --scan
+ run: >
+ ./gradlew clean build dist jacocoTestReport --parallel --daemon --scan
+ -x spotlessJava -x generateGrammarSource -x generateDistLicense -x checkDeniedLicense
env:
- GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Install plugin
run: ./gradlew installPlugin --scan
env:
- GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Upload coverage report to codecov.io
run: bash <(curl -s https://codecov.io/bash) || echo 'Failed to upload coverage report!'
diff --git a/.github/workflows/code-scanning.yml b/.github/workflows/code-scanning.yml
index 0a7b2ecb28..5476923b0a 100644
--- a/.github/workflows/code-scanning.yml
+++ b/.github/workflows/code-scanning.yml
@@ -60,7 +60,7 @@ jobs:
- name: Setup Gradle
if: matrix.language == 'java'
- uses: gradle/actions/setup-gradle@v3
+ uses: gradle/actions/setup-gradle@v4
with:
cache-disabled: true
@@ -68,7 +68,7 @@ jobs:
if: matrix.language == 'java'
run: ./gradlew clean assemble compileTestJava --parallel --daemon --scan
env:
- GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index dfb36970d0..171c787369 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -41,10 +41,10 @@ jobs:
apache/eventmesh
- name: Build and push
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./docker/Dockerfile_jdk8
- context: ./
+ context: ./
\ No newline at end of file
diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml
index ca0e0936a6..9172e85414 100644
--- a/.github/workflows/license.yml
+++ b/.github/workflows/license.yml
@@ -38,7 +38,7 @@ jobs:
java-version: 11
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v3
+ uses: gradle/actions/setup-gradle@v4
- name: Check license compatibility
run: ./gradlew clean checkDeniedLicense
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index c1e4f4ab15..8b5b166215 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -42,7 +42,7 @@ jobs:
It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.
If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.
- exempt-issue-labels: 'pinned,discussion,help wanted,WIP,weopen-star,GLCC,summer of code'
+ exempt-issue-labels: 'pinned,discussion,help wanted,WIP,weopen-star,GLCC,GSoC'
exempt-pr-labels: 'help wanted,dependencies'
exempt-all-milestones: true # Exempt all issues/PRs with milestones from stale
operations-per-run: 300
diff --git a/.idea/icon.png b/.idea/icon.png
deleted file mode 100644
index 59aa06dac9..0000000000
Binary files a/.idea/icon.png and /dev/null differ
diff --git a/README.md b/README.md
index 67944cbb51..b9975018dd 100644
--- a/README.md
+++ b/README.md
@@ -180,26 +180,21 @@ eventmesh-runtime-0-a-0 1/1 Running 0 15s
## Contributing
+[](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) [](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) [](https://github.com/apache/eventmesh/pulls?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) [](https://github.com/apache/eventmesh/issues?q=is%3Aopen)
+
Each contributor has played an important role in promoting the robust development of Apache EventMesh. We sincerely appreciate all contributors who have contributed code and documents.
- [Contributing Guideline](https://eventmesh.apache.org/community/contribute/contribute)
- [Good First Issues](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
-Here is the [List of Contributors](https://github.com/apache/eventmesh/graphs/contributors), thank you all! :)
-
-
-
-
-
## CNCF Landscape
diff --git a/build.gradle b/build.gradle
index 3fc27890d1..2e50eb3891 100644
--- a/build.gradle
+++ b/build.gradle
@@ -42,17 +42,17 @@ buildscript {
dependencies {
classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.5"
- classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
+ classpath "io.spring.gradle:dependency-management-plugin:1.1.6"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.13.0"
classpath "org.apache.httpcomponents:httpclient:4.5.14"
- classpath "commons-io:commons-io:2.11.0"
+ classpath "commons-io:commons-io:2.18.0"
}
}
plugins {
id 'org.cyclonedx.bom' version '1.8.2'
- id 'com.github.jk1.dependency-license-report' version '2.7'
+ id 'com.github.jk1.dependency-license-report' version '2.9'
}
allprojects {
@@ -95,10 +95,12 @@ allprojects {
checkstyleMain.exclude('**/org/apache/eventmesh/client/grpc/protos**')
.exclude('**/org/apache/eventmesh/common/protocol/grpc/cloudevents**')
- .exclude('**/org/apache/eventmesh/common/protocol/grpc/protos/**')
+ .exclude('**/org/apache/eventmesh/common/protocol/grpc/proto**')
+ .exclude('**/org/apache/eventmesh/common/protocol/grpc/adminserver/**')
.exclude('**/org/apache/eventmesh/connector/openfunction/client/EventMeshGrpcService**')
.exclude('**/org/apache/eventmesh/connector/openfunction/client/CallbackServiceGrpc**')
.exclude('**/org/apache/eventmesh/connector/jdbc/antlr**')
+ .exclude('**/org/apache/eventmesh/meta/raft/rpc/**')
dependencies {
repositories {
@@ -107,7 +109,7 @@ allprojects {
url "https://maven.aliyun.com/repository/public"
}
}
- testImplementation "org.junit.jupiter:junit-jupiter:5.6.0"
+ testImplementation "org.junit.jupiter:junit-jupiter:5.11.0"
}
spotless {
@@ -161,9 +163,13 @@ tasks.register('dist') {
["eventmesh-common",
"eventmesh-meta:eventmesh-meta-api",
"eventmesh-metrics-plugin:eventmesh-metrics-api",
+ "eventmesh-openconnect:eventmesh-openconnect-java",
+ "eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api",
"eventmesh-protocol-plugin:eventmesh-protocol-api",
+ "eventmesh-registry:eventmesh-registry-api",
"eventmesh-retry:eventmesh-retry-api",
"eventmesh-runtime",
+ "eventmesh-runtime-v2",
"eventmesh-security-plugin:eventmesh-security-api",
"eventmesh-spi",
"eventmesh-starter",
@@ -204,6 +210,48 @@ tasks.register('dist') {
}
}
+tasks.register('dist-admin') {
+ subprojects.forEach { subProject ->
+ dependsOn("${subProject.path}:jar")
+ }
+ def includedProjects =
+ [
+ "eventmesh-admin-server",
+ "eventmesh-common",
+ "eventmesh-spi",
+ "eventmesh-registry:eventmesh-registry-api",
+ "eventmesh-registry:eventmesh-registry-nacos",
+ "eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api"
+ ]
+ doLast {
+ includedProjects.each {
+ def subProject = findProject(it)
+ copy {
+ from subProject.jar.archivePath
+ into rootProject.file('dist/apps')
+ }
+ copy {
+ from subProject.configurations.runtimeClasspath
+ into rootProject.file('dist/lib')
+ exclude 'eventmesh-*'
+ }
+ copy {
+ from subProject.file('bin')
+ into rootProject.file('dist/bin')
+ }
+ copy {
+ from subProject.file('conf')
+ from subProject.sourceSets.main.resources.srcDirs
+ into rootProject.file('dist/conf')
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ exclude 'META-INF'
+ }
+
+ }
+ }
+
+}
+
tasks.register('installPlugin') {
var pluginProjects = subprojects.findAll {
it.file('gradle.properties').exists()
@@ -402,10 +450,11 @@ tasks.register('checkDeniedLicense') {
"GPL-1.0", "GPL-2.0", "GPL-3.0", "AGPL-3.0", "LGPL-2.0", "LGPL-2.1", "LGPL-3.0",
"GPL-1.0-only", "GPL-2.0-only", "GPL-3.0-only", "AGPL-3.0-only", "LGPL-2.0-only", "LGPL-2.1-only", "LGPL-3.0-only",
"QPL-1.0", "Sleepycat", "SSPL-1.0", "CPOL-1.02",
- "BSD-4-Clause", "BSD-4-Clause-UC", "NPL-1.0", "NPL-1.1", "JSON"
+ "BSD-4-Clause", "BSD-4-Clause-UC", "NPL-1.0", "NPL-1.1", "JSON",
+ "The GNU General Public License, v2 with Universal FOSS Exception, v1.0"
]
// Update exemptions according to https://github.com/apache/eventmesh/issues/4842
- def allowedArtifacts = ["amqp-client", "stax-api", "javassist", "ST4", "xsdlib"]
+ def allowedArtifacts = ["amqp-client", "stax-api", "javassist", "ST4", "xsdlib", "jsqlparser"]
def licenseFile = file('tools/dist-license/LICENSE')
def lines = licenseFile.readLines()
@@ -648,33 +697,30 @@ subprojects {
sign publishing.publications.mavenJava
}
- def grpcVersion = '1.64.0'
- def log4jVersion = '2.23.1'
- def jacksonVersion = '2.17.1'
- def dropwizardMetricsVersion = '4.2.25'
+ def grpcVersion = '1.68.0'
+ def log4jVersion = '2.24.1'
+ def jacksonVersion = '2.18.0'
+ def dropwizardMetricsVersion = '4.2.26'
def opentelemetryVersion = '1.36.0'
- def cloudeventsVersion = '2.5.0'
- def curatorVersion = '5.6.0'
- def mockitoVersion = '3.12.4'
+ def cloudeventsVersion = '3.0.0'
+ def curatorVersion = '5.7.0'
+ def mockitoVersion = '4.11.0'
dependencyManagement {
dependencies {
- dependency "org.apache.commons:commons-lang3:3.6"
+ dependency "org.apache.commons:commons-lang3:3.17.0"
dependency "org.apache.commons:commons-collections4:4.4"
- dependency "org.apache.commons:commons-text:1.9"
-
- dependency "commons-io:commons-io:2.11.0"
-
- dependency "commons-validator:commons-validator:1.7"
-
- dependency "com.google.guava:guava:31.1-jre"
+ dependency "org.apache.commons:commons-text:1.12.0"
+ dependency "commons-io:commons-io:2.18.0"
+ dependency "commons-validator:commons-validator:1.9.0"
+ dependency "com.google.guava:guava:33.3.0-jre"
dependency "org.slf4j:slf4j-api:2.0.13"
dependency "org.apache.logging.log4j:log4j-api:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-core:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
- dependency "com.lmax:disruptor:3.4.2"
+ dependency "com.lmax:disruptor:3.4.4"
dependency "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
dependency "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
@@ -684,10 +730,10 @@ subprojects {
dependency "com.squareup.okhttp3:okhttp:3.14.9"
- dependency "org.asynchttpclient:async-http-client:2.12.0"
+ dependency "org.asynchttpclient:async-http-client:2.12.3"
dependency "org.apache.httpcomponents:httpclient:4.5.14"
- dependency "io.netty:netty-all:4.1.79.Final"
+ dependency "io.netty:netty-all:4.1.112.Final"
dependency "io.dropwizard.metrics:metrics-core:${dropwizardMetricsVersion}"
dependency "io.dropwizard.metrics:metrics-healthchecks:${dropwizardMetricsVersion}"
@@ -704,16 +750,16 @@ subprojects {
dependency "io.openmessaging:openmessaging-api:2.2.1-pubsub"
- dependency "com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0"
- dependency "com.mebigfatguy.fb-contrib:fb-contrib:7.6.0"
+ dependency "com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0"
+ dependency "com.mebigfatguy.fb-contrib:fb-contrib:7.6.4"
dependency "com.jayway.jsonpath:json-path:2.9.0"
dependency "org.springframework.boot:spring-boot-starter-web:2.7.18"
dependency "io.openmessaging:registry-server:0.0.1"
- dependency "org.junit.jupiter:junit-jupiter:5.6.0"
+ dependency "org.junit.jupiter:junit-jupiter:5.11.0"
dependency "org.junit-pioneer:junit-pioneer:1.9.1"
- dependency "org.assertj:assertj-core:2.6.0"
+ dependency "org.assertj:assertj-core:3.26.3"
dependency "org.mockito:mockito-core:${mockitoVersion}"
dependency "org.mockito:mockito-inline:${mockitoVersion}"
@@ -731,12 +777,12 @@ subprojects {
dependency "javax.annotation:javax.annotation-api:1.3.2"
- dependency "com.github.seancfoley:ipaddress:5.3.3"
+ dependency "com.github.seancfoley:ipaddress:5.5.0"
dependency "com.google.code.gson:gson:2.11.0"
dependency "org.javassist:javassist:3.30.2-GA"
- dependency "com.alibaba.nacos:nacos-client:2.3.2"
+ dependency "com.alibaba.nacos:nacos-client:2.4.1"
dependency 'org.apache.zookeeper:zookeeper:3.9.2'
dependency "org.apache.curator:curator-client:${curatorVersion}"
@@ -744,13 +790,18 @@ subprojects {
dependency "org.apache.curator:curator-recipes:${curatorVersion}"
dependency "org.apache.curator:curator-test:${curatorVersion}"
- dependency "org.projectlombok:lombok:1.18.32"
- dependency "com.github.seancfoley:ipaddress:5.3.3"
+ dependency "org.projectlombok:lombok:1.18.34"
dependency "javax.annotation:javax.annotation-api:1.3.2"
- dependency "com.alibaba.fastjson2:fastjson2:2.0.48"
+ dependency "com.alibaba.fastjson2:fastjson2:2.0.52"
- dependency "software.amazon.awssdk:s3:2.25.55"
+ dependency "software.amazon.awssdk:s3:2.29.5"
dependency "com.github.rholder:guava-retrying:2.0.0"
+
+ dependency "com.alibaba:druid-spring-boot-starter:1.2.23"
+ dependency "com.baomidou:mybatis-plus-boot-starter:3.5.7"
+ dependency "com.mysql:mysql-connector-j:8.4.0"
+ dependency "org.springframework.boot:spring-boot-starter-jetty:2.7.18"
+ dependency "org.locationtech.jts:jts-core:1.20.0"
}
}
}
diff --git a/eventmesh-admin-server/.gitignore b/eventmesh-admin-server/.gitignore
new file mode 100644
index 0000000000..b63da4551b
--- /dev/null
+++ b/eventmesh-admin-server/.gitignore
@@ -0,0 +1,42 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/eventmesh-admin-server/bin/start-admin.sh b/eventmesh-admin-server/bin/start-admin.sh
new file mode 100644
index 0000000000..1633036617
--- /dev/null
+++ b/eventmesh-admin-server/bin/start-admin.sh
@@ -0,0 +1,200 @@
+#!/bin/bash
+#
+# Licensed to 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. Apache Software Foundation (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.
+
+#===========================================================================================
+# Java Environment Setting
+#===========================================================================================
+set -e
+# Server configuration may be inconsistent, add these configurations to avoid garbled code problems
+export LANG=en_US.UTF-8
+export LC_CTYPE=en_US.UTF-8
+export LC_ALL=en_US.UTF-8
+
+TMP_JAVA_HOME="/customize/your/java/home/here"
+
+# Detect operating system.
+OS=$(uname)
+
+function is_java8_or_11 {
+ local _java="$1"
+ [[ -x "$_java" ]] || return 1
+ [[ "$("$_java" -version 2>&1)" =~ 'java version "1.8' || "$("$_java" -version 2>&1)" =~ 'openjdk version "1.8' || "$("$_java" -version 2>&1)" =~ 'java version "11' || "$("$_java" -version 2>&1)" =~ 'openjdk version "11' ]] || return 2
+ return 0
+}
+
+function extract_java_version {
+ local _java="$1"
+ local version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{if ($1 == 1 && $2 == 8) print "8"; else if ($1 == 11) print "11"; else print "unknown"}')
+ echo "$version"
+}
+
+# 0(not running), 1(is running)
+#function is_proxyRunning {
+# local _pid="$1"
+# local pid=`ps ax | grep -i 'org.apache.eventmesh.runtime.boot.EventMeshStartup' |grep java | grep -v grep | awk '{print $1}'|grep $_pid`
+# if [ -z "$pid" ] ; then
+# return 0
+# else
+# return 1
+# fi
+#}
+
+function get_pid {
+ local ppid=""
+ if [ -f ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file ]; then
+ ppid=$(cat ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file)
+ # If the process does not exist, it indicates that the previous process terminated abnormally.
+ if [ ! -d /proc/$ppid ]; then
+ # Remove the residual file.
+ rm ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+ echo -e "ERROR\t EventMesh process had already terminated unexpectedly before, please check log output."
+ ppid=""
+ fi
+ else
+ if [[ $OS =~ Msys ]]; then
+ # There is a Bug on Msys that may not be able to kill the identified process
+ ppid=`jps -v | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ elif [[ $OS =~ Darwin ]]; then
+ # Known problem: grep Java may not be able to accurately identify Java processes
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ else
+ if [ $DOCKER ]; then
+ # No need to exclude root user in Docker containers.
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | awk -F ' ' {'print $2'})
+ else
+ # It is required to identify the process as accurately as possible on Linux.
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" | awk -F ' ' {'print $2'})
+ fi
+ fi
+ fi
+ echo "$ppid";
+}
+
+#===========================================================================================
+# Locate Java Executable
+#===========================================================================================
+
+if [[ -d "$TMP_JAVA_HOME" ]] && is_java8_or_11 "$TMP_JAVA_HOME/bin/java"; then
+ JAVA="$TMP_JAVA_HOME/bin/java"
+ JAVA_VERSION=$(extract_java_version "$TMP_JAVA_HOME/bin/java")
+elif [[ -d "$JAVA_HOME" ]] && is_java8_or_11 "$JAVA_HOME/bin/java"; then
+ JAVA="$JAVA_HOME/bin/java"
+ JAVA_VERSION=$(extract_java_version "$JAVA_HOME/bin/java")
+elif is_java8_or_11 "$(which java)"; then
+ JAVA="$(which java)"
+ JAVA_VERSION=$(extract_java_version "$(which java)")
+else
+ echo -e "ERROR\t Java 8 or 11 not found, operation abort."
+ exit 9;
+fi
+
+echo "EventMesh using Java version: $JAVA_VERSION, path: $JAVA"
+
+EVENTMESH_ADMIN_HOME=$(cd "$(dirname "$0")/.." && pwd)
+export EVENTMESH_ADMIN_HOME
+
+EVENTMESH_ADMIN_LOG_HOME="${EVENTMESH_ADMIN_HOME}/logs"
+export EVENTMESH_ADMIN_LOG_HOME
+
+echo -e "EVENTMESH_ADMIN_HOME : ${EVENTMESH_ADMIN_HOME}\nEVENTMESH_ADMIN_LOG_HOME : ${EVENTMESH_ADMIN_LOG_HOME}"
+
+function make_logs_dir {
+ if [ ! -e "${EVENTMESH_ADMIN_LOG_HOME}" ]; then mkdir -p "${EVENTMESH_ADMIN_LOG_HOME}"; fi
+}
+
+error_exit ()
+{
+ echo -e "ERROR\t $1 !!"
+ exit 1
+}
+
+export JAVA_HOME
+
+#===========================================================================================
+# JVM Configuration
+#===========================================================================================
+#if [ $1 = "prd" -o $1 = "benchmark" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms2048M -Xmx4096M -Xmn2048m -XX:SurvivorRatio=4"
+#elif [ $1 = "sit" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms256M -Xmx512M -Xmn256m -XX:SurvivorRatio=4"
+#elif [ $1 = "dev" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms128M -Xmx256M -Xmn128m -XX:SurvivorRatio=4"
+#fi
+
+GC_LOG_FILE="${EVENTMESH_ADMIN_LOG_HOME}/eventmesh_admin_gc_%p.log"
+
+JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g"
+JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:MaxGCPauseMillis=50"
+JAVA_OPT="${JAVA_OPT} -verbose:gc"
+if [[ "$JAVA_VERSION" == "8" ]]; then
+ # Set JAVA_OPT for Java 8
+ JAVA_OPT="${JAVA_OPT} -Xloggc:${GC_LOG_FILE} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m"
+ JAVA_OPT="${JAVA_OPT} -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy"
+elif [[ "$JAVA_VERSION" == "11" ]]; then
+ # Set JAVA_OPT for Java 11
+ XLOG_PARAM="time,level,tags:filecount=5,filesize=30m"
+ JAVA_OPT="${JAVA_OPT} -Xlog:gc*:${GC_LOG_FILE}:${XLOG_PARAM}"
+ JAVA_OPT="${JAVA_OPT} -Xlog:safepoint:${GC_LOG_FILE}:${XLOG_PARAM} -Xlog:ergo*=debug:${GC_LOG_FILE}:${XLOG_PARAM}"
+fi
+JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${EVENTMESH_ADMIN_LOG_HOME} -XX:ErrorFile=${EVENTMESH_ADMIN_LOG_HOME}/hs_err_%p.log"
+JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow"
+JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch"
+JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=8G"
+JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking"
+JAVA_OPT="${JAVA_OPT} -Dio.netty.leakDetectionLevel=advanced"
+JAVA_OPT="${JAVA_OPT} -Dio.netty.allocator.type=pooled"
+JAVA_OPT="${JAVA_OPT} -Djava.security.egd=file:/dev/./urandom"
+JAVA_OPT="${JAVA_OPT} -Dlog4j.configurationFile=${EVENTMESH_ADMIN_HOME}/conf/log4j2.xml"
+JAVA_OPT="${JAVA_OPT} -Deventmesh.log.home=${EVENTMESH_ADMIN_LOG_HOME}"
+JAVA_OPT="${JAVA_OPT} -DconfPath=${EVENTMESH_ADMIN_HOME}/conf"
+JAVA_OPT="${JAVA_OPT} -DconfigurationPath=${EVENTMESH_ADMIN_HOME}/conf"
+JAVA_OPT="${JAVA_OPT} -Dlog4j2.AsyncQueueFullPolicy=Discard"
+JAVA_OPT="${JAVA_OPT} -Drocketmq.client.logUseSlf4j=true"
+JAVA_OPT="${JAVA_OPT} -DeventMeshPluginDir=${EVENTMESH_ADMIN_HOME}/plugin"
+
+#if [ -f "pid.file" ]; then
+# pid=`cat pid.file`
+# if ! is_proxyRunning "$pid"; then
+# echo "proxy is running already"
+# exit 9;
+# else
+# echo "err pid$pid, rm pid.file"
+# rm pid.file
+# fi
+#fi
+
+pid=$(get_pid)
+if [[ $pid == "ERROR"* ]]; then
+ echo -e "${pid}"
+ exit 9
+fi
+if [ -n "$pid" ]; then
+ echo -e "ERROR\t The server is already running (pid=$pid), there is no need to execute start.sh again."
+ exit 9
+fi
+
+make_logs_dir
+
+echo "Using Java version: $JAVA_VERSION, path: $JAVA" >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out
+
+EVENTMESH_ADMIN_MAIN=org.apache.eventmesh.admin.server.ExampleAdminServer
+if [ $DOCKER ]; then
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME}/conf:${EVENTMESH_ADMIN_HOME}/apps/*:${EVENTMESH_ADMIN_HOME}/lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out
+else
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME}/conf:${EVENTMESH_ADMIN_HOME}/apps/*:${EVENTMESH_ADMIN_HOME}/lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out 2>&1 &
+echo $!>${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+fi
+exit 0
diff --git a/eventmesh-admin-server/bin/stop-admin.sh b/eventmesh-admin-server/bin/stop-admin.sh
new file mode 100644
index 0000000000..207531d7fa
--- /dev/null
+++ b/eventmesh-admin-server/bin/stop-admin.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+#
+# Licensed to 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. Apache Software Foundation (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.
+
+# Detect operating system
+OS=$(uname)
+
+EVENTMESH_ADMIN_HOME=`cd $(dirname $0)/.. && pwd`
+
+export EVENTMESH_ADMIN_HOME
+
+function get_pid {
+ local ppid=""
+ if [ -f ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file ]; then
+ ppid=$(cat ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file)
+ # If the process does not exist, it indicates that the previous process terminated abnormally.
+ if [ ! -d /proc/$ppid ]; then
+ # Remove the residual file and return an error status.
+ rm ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+ echo -e "ERROR\t EventMesh admin process had already terminated unexpectedly before, please check log output."
+ ppid=""
+ fi
+ else
+ if [[ $OS =~ Msys ]]; then
+ # There is a Bug on Msys that may not be able to kill the identified process
+ ppid=`jps -v | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ elif [[ $OS =~ Darwin ]]; then
+ # Known problem: grep Java may not be able to accurately identify Java processes
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ else
+ # It is required to identify the process as accurately as possible on Linux
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ fi
+ fi
+ echo "$ppid";
+}
+
+pid=$(get_pid)
+if [[ $pid == "ERROR"* ]]; then
+ echo -e "${pid}"
+ exit 9
+fi
+if [ -z "$pid" ];then
+ echo -e "ERROR\t No EventMesh admin server running."
+ exit 9
+fi
+
+kill ${pid}
+echo "Send shutdown request to EventMesh admin(${pid}) OK"
+
+[[ $OS =~ Msys ]] && PS_PARAM=" -W "
+stop_timeout=60
+for no in $(seq 1 $stop_timeout); do
+ if ps $PS_PARAM -p "$pid" 2>&1 > /dev/null; then
+ if [ $no -lt $stop_timeout ]; then
+ echo "[$no] server shutting down ..."
+ sleep 1
+ continue
+ fi
+
+ echo "shutdown server timeout, kill process: $pid"
+ kill -9 $pid; sleep 1; break;
+ echo "`date +'%Y-%m-%-d %H:%M:%S'` , pid : [$pid] , error message : abnormal shutdown which can not be closed within 60s" > ../logs/shutdown.error
+ else
+ echo "shutdown server ok!"; break;
+ fi
+done
+
+if [ -f "pid-admin.file" ]; then
+ rm pid-admin.file
+fi
+
+
diff --git a/eventmesh-admin-server/build.gradle b/eventmesh-admin-server/build.gradle
new file mode 100644
index 0000000000..fdfe1bffe8
--- /dev/null
+++ b/eventmesh-admin-server/build.gradle
@@ -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.
+ */
+
+dependencies {
+ implementation project(":eventmesh-spi")
+ implementation project(":eventmesh-common")
+ implementation project(":eventmesh-registry:eventmesh-registry-api")
+ implementation project(":eventmesh-registry:eventmesh-registry-nacos")
+ implementation project(":eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api")
+ implementation "com.alibaba.nacos:nacos-client"
+ implementation("org.springframework.boot:spring-boot-starter-web") {
+ exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
+ }
+ implementation 'org.springframework.boot:spring-boot-starter-jetty'
+ implementation "io.grpc:grpc-core"
+ implementation "io.grpc:grpc-protobuf"
+ implementation "io.grpc:grpc-stub"
+ implementation "io.grpc:grpc-netty-shaded"
+
+ // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
+ implementation "com.baomidou:mybatis-plus-boot-starter"
+
+ // https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter
+ implementation "com.alibaba:druid-spring-boot-starter"
+ compileOnly 'com.mysql:mysql-connector-j'
+ compileOnly 'org.projectlombok:lombok'
+ testImplementation 'junit:junit:4.13.2'
+ testImplementation 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+}
+
+configurations.implementation {
+ exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
+}
+
+sourceSets {
+ main {
+ resources {
+ srcDirs = ['src/main/resources', 'conf']
+ }
+ }
+}
+
diff --git a/eventmesh-admin-server/conf/application.yaml b/eventmesh-admin-server/conf/application.yaml
new file mode 100644
index 0000000000..7765d90ce8
--- /dev/null
+++ b/eventmesh-admin-server/conf/application.yaml
@@ -0,0 +1,58 @@
+#
+# 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.
+#
+
+spring:
+ datasource:
+ url: jdbc:mysql://localhost:3306/eventmesh?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
+ username: //db_username
+ password: //db_password
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ initialSize: 1
+ minIdle: 1
+ maxActive: 20
+ maxWait: 10000
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: false
+ maxPoolPreparedStatementPerConnectionSize: 20
+ filters: stat
+ connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000"
+# secret keys
+sysPubKey:
+appPrivKey:
+
+mybatis-plus:
+ mapper-locations: classpath:mapper/*.xml
+ configuration:
+ map-underscore-to-camel-case: false
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# http server port
+server:
+ port: 8082
+event-mesh:
+ admin-server:
+ serviceName: DEFAULT_GROUP@@em_adm_server
+ # grpc server port
+ port: 8081
+ adminServerList:
+ R1: http://localhost:8082;http://localhost:8082
+ R2: http://localhost:8092;http://localhost:8092
+ region: R1
\ No newline at end of file
diff --git a/eventmesh-admin-server/conf/eventmesh-admin.properties b/eventmesh-admin-server/conf/eventmesh-admin.properties
new file mode 100644
index 0000000000..30507ec02c
--- /dev/null
+++ b/eventmesh-admin-server/conf/eventmesh-admin.properties
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+eventMesh.registry.plugin.type=nacos
+eventMesh.registry.plugin.server-addr=localhost:8848
diff --git a/eventmesh-admin-server/conf/eventmesh.sql b/eventmesh-admin-server/conf/eventmesh.sql
new file mode 100644
index 0000000000..4d11ab1585
--- /dev/null
+++ b/eventmesh-admin-server/conf/eventmesh.sql
@@ -0,0 +1,185 @@
+-- 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.
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET NAMES utf8 */;
+/*!50503 SET NAMES utf8 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+-- export eventmesh database
+CREATE DATABASE IF NOT EXISTS `eventmesh` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */ /*!80016 DEFAULT ENCRYPTION='N' */;
+USE `eventmesh`;
+
+-- 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` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `description` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `configuration` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `configurationClass` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `region` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8_bin 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 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_job_info structure
+CREATE TABLE IF NOT EXISTS `event_mesh_job_info` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `jobDesc` varchar(50) COLLATE utf8_bin NOT NULL,
+ `taskID` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `transportType` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `sourceData` int NOT NULL DEFAULT '0',
+ `targetData` int NOT NULL DEFAULT '0',
+ `jobState` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `jobType` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `fromRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `runningRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `updateUid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `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 `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- 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` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `serverUUID` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `position` bigint DEFAULT NULL,
+ `gtid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `currentGtid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `timestamp` bigint DEFAULT NULL,
+ `journalName` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin 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 DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC;
+
+-- 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` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `record` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ KEY `job` (`job`),
+ KEY `address` (`address`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='record position reporter changes';
+
+-- 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 utf8 COLLATE utf8_bin NOT NULL,
+ `runtimeAddr` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `reportTime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin 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`),
+ KEY `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_runtime_history structure
+CREATE TABLE IF NOT EXISTS `event_mesh_runtime_history` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `job` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ KEY `address` (`address`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin 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 utf8_bin NOT NULL,
+ `taskName` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `taskDesc` varchar(50) COLLATE utf8_bin NOT NULL,
+ `taskState` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'taskstate',
+ `sourceRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `targetRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8_bin 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=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_verify structure
+CREATE TABLE IF NOT EXISTS `event_mesh_verify` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `recordID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `recordSig` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `connectorName` varchar(200) COLLATE utf8_bin DEFAULT NULL,
+ `connectorStage` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `position` text COLLATE utf8_bin DEFAULT NULL,
+ `createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- eventmesh.event_mesh_weredis_position definition
+CREATE TABLE `event_mesh_weredis_position` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `address` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `clusterName` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `partitionName` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `masterReplid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `host` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `replOffset` bigint(20) NOT NULL DEFAULT '-1',
+ `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=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC;
+
+
+CREATE TABLE `event_mesh_monitor` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `address` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `transportType` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `connectorStage` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `totalReqNum` bigint DEFAULT NULL,
+ `totalTimeCost` bigint DEFAULT NULL,
+ `maxTimeCost` bigint DEFAULT NULL,
+ `avgTimeCost` bigint DEFAULT NULL,
+ `tps` double DEFAULT NULL,
+ `createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
+/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
diff --git a/eventmesh-admin-server/conf/log4j2.xml b/eventmesh-admin-server/conf/log4j2.xml
new file mode 100644
index 0000000000..acc6acb8ba
--- /dev/null
+++ b/eventmesh-admin-server/conf/log4j2.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
new file mode 100644
index 0000000000..50e6ad82cc
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,dataType,description,
+ configuration,configurationClass,region,
+ createUid,updateUid,createTime,updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
new file mode 100644
index 0000000000..a053d1c838
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,jobID,jobDesc,
+ taskID,transportType,sourceData,
+ targetData,jobState,jobType,
+ fromRegion,runningRegion,createUid,
+ updateUid,createTime,updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml
new file mode 100644
index 0000000000..f77fb8ba77
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,jobID,address,transportType,connectorStage,
+ totalReqNum,totalTimeCost,maxTimeCost,avgTimeCost,
+ tps,createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
new file mode 100644
index 0000000000..9bcc7f42bb
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
new file mode 100644
index 0000000000..a9e4fe6f1b
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,job,record,
+ address,createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
new file mode 100644
index 0000000000..200b1bf54a
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,adminAddr,runtimeAddr,
+ jobID,reportTime,updateTime,
+ createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
new file mode 100644
index 0000000000..281cce30f9
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,job,address,
+ createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
new file mode 100644
index 0000000000..c3514fd945
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,taskName,
+ taskDesc,taskState,sourceRegion,targetRegion,
+ 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..45727498cc
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,jobID,recordID,
+ recordSig,connectorName,connectorStage,
+ position,createTime
+
+
diff --git a/eventmesh-admin-server/gradle.properties b/eventmesh-admin-server/gradle.properties
new file mode 100644
index 0000000000..a9fd83fea0
--- /dev/null
+++ b/eventmesh-admin-server/gradle.properties
@@ -0,0 +1,16 @@
+#
+# 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.
+#
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.java
new file mode 100644
index 0000000000..2e6d3c018a
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.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;
+
+import java.util.Map;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@ConfigurationProperties("event-mesh.admin-server")
+@Getter
+@Setter
+public class AdminServerProperties {
+
+ private int port;
+ private boolean enableSSL;
+ private String configurationPath;
+ private String configurationFile;
+ private String serviceName;
+ private Map adminServerList;
+ private String region;
+}
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
new file mode 100644
index 0000000000..e68d05100f
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+import lombok.Getter;
+
+@Getter
+public class AdminServerRuntimeException extends RuntimeException {
+ private final int code;
+
+ public AdminServerRuntimeException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+}
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
new file mode 100644
index 0000000000..d0f2111041
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.admin.server.constants.AdminServerConstants;
+import org.apache.eventmesh.common.config.ConfigService;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@SpringBootApplication(scanBasePackages = "org.apache.eventmesh.admin.server", exclude = {DataSourceAutoConfiguration.class})
+public class ExampleAdminServer {
+
+ public static void main(String[] args) throws Exception {
+ ConfigService.getInstance().setConfigPath(AdminServerConstants.EVENTMESH_CONF_HOME).setRootConfig(AdminServerConstants.EVENTMESH_CONF_FILE);
+ SpringApplication.run(ExampleAdminServer.class);
+ log.info("admin start success.");
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java
new file mode 100644
index 0000000000..8ed079fd31
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java
@@ -0,0 +1,26 @@
+/*
+ * 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.constants;
+
+public class AdminServerConstants {
+ public static final String CONF_ENV = "configurationPath";
+
+ public static final String EVENTMESH_CONF_HOME = System.getProperty(CONF_ENV, System.getenv(CONF_ENV));
+
+ public static final String EVENTMESH_CONF_FILE = "eventmesh-admin.properties";
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java
new file mode 100644
index 0000000000..9bbe4ce305
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.common.ComponentLifeCycle;
+import org.apache.eventmesh.common.remote.payload.PayloadFactory;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class BaseServer implements ComponentLifeCycle {
+
+ static {
+ PayloadFactory.getInstance().init();
+ }
+
+ @PostConstruct
+ public void init() throws Exception {
+ log.info("[{}] server starting at port [{}]", this.getClass().getSimpleName(), getPort());
+ start();
+ log.info("[{}] server started at port [{}]", this.getClass().getSimpleName(), getPort());
+ }
+
+ @PreDestroy
+ public void shutdown() throws Exception {
+ log.info("[{}] server will destroy", this.getClass().getSimpleName());
+ stop();
+ log.info("[{}] server has be destroy", this.getClass().getSimpleName());
+ }
+
+ public abstract int getPort();
+}
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
new file mode 100644
index 0000000000..d2a0330355
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
@@ -0,0 +1,74 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.admin.server.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.service.AdminGrpcServer;
+
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
+import io.grpc.Server;
+import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Controller
+@Slf4j
+public class GrpcServer extends BaseServer {
+
+ @Autowired
+ AdminGrpcServer adminGrpcServer;
+
+ @Autowired
+ AdminServerProperties properties;
+
+ private Server server;
+
+ @Override
+ public void start() throws Exception {
+ NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(getPort()).addService(adminGrpcServer);
+ if (properties.isEnableSSL()) {
+ serverBuilder.sslContext(null);
+ }
+ server = serverBuilder.build();
+ server.start();
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (server != null) {
+ server.shutdown();
+ if (!server.awaitTermination(30, TimeUnit.SECONDS)) {
+ log.warn("[{}] server don't graceful stop in 30s, it will shutdown now", this.getClass().getSimpleName());
+ server.shutdownNow();
+ }
+ }
+ } catch (InterruptedException e) {
+ log.warn("destroy [{}] server fail", this.getClass().getSimpleName(), e);
+ }
+ }
+
+ @Override
+ public int getPort() {
+ return properties.getPort();
+ }
+}
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
new file mode 100644
index 0000000000..0a20d8645e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
@@ -0,0 +1,183 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+import org.apache.eventmesh.admin.server.web.service.monitor.MonitorBizService;
+import org.apache.eventmesh.admin.server.web.service.task.TaskBizService;
+import org.apache.eventmesh.admin.server.web.service.verify.VerifyBizService;
+import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
+import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
+import org.apache.eventmesh.common.remote.request.QueryTaskMonitorRequest;
+import org.apache.eventmesh.common.remote.request.ReportMonitorRequest;
+import org.apache.eventmesh.common.remote.request.ReportVerifyRequest;
+import org.apache.eventmesh.common.remote.request.TaskBachRequest;
+import org.apache.eventmesh.common.remote.request.TaskIDRequest;
+import org.apache.eventmesh.common.remote.response.CreateTaskResponse;
+import org.apache.eventmesh.common.remote.response.HttpResponseResult;
+import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
+import org.apache.eventmesh.common.remote.response.QueryTaskMonitorResponse;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import lombok.extern.slf4j.Slf4j;
+
+@RestController
+@RequestMapping("/eventmesh/admin")
+@Slf4j
+public class HttpServer {
+
+ @Autowired
+ private TaskBizService taskService;
+
+ @Autowired
+ private VerifyBizService verifyService;
+
+ @Autowired
+ private MonitorBizService monitorService;
+
+ @Autowired
+ private EventMeshTaskInfoService taskInfoService;
+
+ @RequestMapping(value = "/createTask", method = RequestMethod.POST)
+ public String createOrUpdateTask(@RequestBody CreateTaskRequest task) {
+ log.info("receive http proto create task:{}", task);
+ CreateTaskResponse createTaskResponse = taskService.createTask(task);
+ log.info("receive http proto create task result:{}", createTaskResponse);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(createTaskResponse);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+
+ @RequestMapping(value = "/reportVerify", method = RequestMethod.POST)
+ public String reportVerify(@RequestBody ReportVerifyRequest request) {
+ log.info("receive http proto report verify request:{}", request);
+ boolean result = verifyService.reportVerifyRecord(request);
+ log.info("receive http proto report verify result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/reportMonitor", method = RequestMethod.POST)
+ public String reportMonitor(@RequestBody ReportMonitorRequest request) {
+ log.info("receive http proto report monitor request:{}", request);
+ boolean result = monitorService.reportMonitorRecord(request);
+ log.info("receive http proto report monitor result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/queryTaskMonitor", method = RequestMethod.POST)
+ public String queryTaskMonitor(@RequestBody QueryTaskMonitorRequest request) {
+ log.info("receive http proto query task monitor request:{}", request);
+ QueryTaskMonitorResponse result = monitorService.queryTaskMonitors(request);
+ log.info("receive http proto query task monitor result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/queryTaskInfo", method = RequestMethod.POST)
+ public HttpResponseResult queryTaskInfo(@RequestBody QueryTaskInfoRequest taskInfoRequest) {
+ log.info("receive http query task info request:{}", taskInfoRequest);
+ List taskInfosResponse = taskService.queryTaskInfo(taskInfoRequest);
+ log.info("receive http query task info taskInfosResponse:{}", taskInfoRequest);
+ if (taskInfosResponse.isEmpty()) {
+ return HttpResponseResult.failed("NOT FOUND");
+ }
+ return HttpResponseResult.success(taskInfosResponse);
+ }
+
+ @RequestMapping(value = "/deleteTask", method = RequestMethod.DELETE)
+ public HttpResponseResult deleteTask(@RequestBody TaskIDRequest taskIDRequest) {
+ log.info("receive need to delete taskID:{}", taskIDRequest.getTaskID());
+ boolean result = taskService.deleteTaskByTaskID(taskIDRequest);
+ if (result) {
+ return HttpResponseResult.success();
+ } else {
+ return HttpResponseResult.failed();
+ }
+ }
+
+ @RequestMapping(value = "/startTask", method = RequestMethod.POST)
+ public HttpResponseResult startTask(@RequestBody TaskIDRequest taskIDRequest) {
+ log.info("receive start task ID:{}", taskIDRequest.getTaskID());
+ taskService.startTask(taskIDRequest);
+ return HttpResponseResult.success();
+ }
+
+ @RequestMapping(value = "/restartTask", method = RequestMethod.POST)
+ public HttpResponseResult restartTask(@RequestBody TaskIDRequest taskIDRequest) {
+ log.info("receive restart task ID:{}", taskIDRequest.getTaskID());
+ taskService.restartTask(taskIDRequest);
+ return HttpResponseResult.success();
+ }
+
+ @RequestMapping(value = "/stopTask", method = RequestMethod.POST)
+ public HttpResponseResult stopTask(@RequestBody TaskIDRequest taskIDRequest) {
+ log.info("receive stop task ID:{}", taskIDRequest.getTaskID());
+ taskService.stopTask(taskIDRequest);
+ return HttpResponseResult.success();
+ }
+
+ @RequestMapping(value = "/restartBatch", method = RequestMethod.POST)
+ public HttpResponseResult restartBatch(@RequestBody List taskBachRequestList) {
+ log.info("receive restart batch task IDs:{}", taskBachRequestList);
+ List errorNames = new ArrayList<>();
+ taskService.restartBatchTask(taskBachRequestList, errorNames);
+ if (!errorNames.isEmpty()) {
+ return HttpResponseResult.failed(errorNames);
+ }
+ return HttpResponseResult.success();
+ }
+
+ @RequestMapping(value = "stopBatch", method = RequestMethod.POST)
+ public HttpResponseResult stopBatch(@RequestBody List taskBachRequestList) {
+ log.info("receive stop batch task IDs:{}", taskBachRequestList);
+ List errorNames = new ArrayList<>();
+ taskService.stopBatchTask(taskBachRequestList, errorNames);
+ if (!errorNames.isEmpty()) {
+ return HttpResponseResult.failed(errorNames);
+ }
+ return HttpResponseResult.success();
+ }
+
+ @RequestMapping(value = "/startBatch", method = RequestMethod.POST)
+ public HttpResponseResult startBatch(@RequestBody List taskBachRequestList) {
+ log.info("receive start batch task IDs:{}", taskBachRequestList);
+ List errorNames = new ArrayList<>();
+ taskService.startBatchTask(taskBachRequestList, errorNames);
+ if (!errorNames.isEmpty()) {
+ return HttpResponseResult.failed(errorNames);
+ }
+ return HttpResponseResult.success();
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Request.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Request.java
new file mode 100644
index 0000000000..9484e986f1
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Request.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;
+
+public class Request {
+ private String uid;
+ private T data;
+
+ public String getUid() {
+ return uid;
+ }
+
+ public void setUid(String uid) {
+ this.uid = uid;
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+}
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
new file mode 100644
index 0000000000..d573c3bac4
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class Response {
+
+ private int code;
+
+ private boolean success;
+
+ private String desc;
+
+ private T data;
+
+ public static Response success() {
+ Response response = new Response<>();
+ response.success = true;
+ response.code = ErrorCode.SUCCESS;
+ return response;
+ }
+
+ public static Response success(T data) {
+ Response response = new Response<>();
+ response.success = true;
+ response.data = data;
+ return response;
+ }
+
+ public static Response fail(int code, String desc) {
+ Response response = new Response<>();
+ response.success = false;
+ response.code = code;
+ response.desc = desc;
+ return response;
+ }
+
+ 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/ServerController.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/ServerController.java
new file mode 100644
index 0000000000..5623cbad33
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/ServerController.java
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/eventmesh/admin")
+public class ServerController {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/config/MybatisPlusConfig.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/config/MybatisPlusConfig.java
new file mode 100644
index 0000000000..15d362bcd0
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/config/MybatisPlusConfig.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.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+
+@Configuration
+public class MybatisPlusConfig {
+
+ @Bean
+ public MybatisPlusInterceptor paginationInterceptor() {
+ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+ PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
+ pageInterceptor.setMaxLimit(500L);
+ interceptor.addInnerInterceptor(pageInterceptor);
+ return interceptor;
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DBThreadPool.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DBThreadPool.java
new file mode 100644
index 0000000000..277ea66656
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DBThreadPool.java
@@ -0,0 +1,82 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.common.EventMeshThreadFactory;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.PreDestroy;
+
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class DBThreadPool {
+
+ private final ThreadPoolExecutor executor =
+ new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2,
+ Runtime.getRuntime().availableProcessors() * 2, 0L, TimeUnit.SECONDS,
+ new LinkedBlockingQueue<>(1000), new EventMeshThreadFactory("admin-server-db"),
+ new ThreadPoolExecutor.DiscardOldestPolicy());
+
+
+ private final ScheduledThreadPoolExecutor checkScheduledExecutor =
+ new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), new EventMeshThreadFactory("admin-server-check-scheduled"),
+ new ThreadPoolExecutor.DiscardOldestPolicy());
+
+ @PreDestroy
+ private void destroy() {
+ if (!executor.isShutdown()) {
+ try {
+ executor.shutdown();
+ if (!executor.awaitTermination(30, TimeUnit.SECONDS)) {
+ log.info("wait handler thread pool shutdown timeout, it will shutdown immediately");
+ executor.shutdownNow();
+ }
+ } catch (InterruptedException e) {
+ log.warn("wait handler thread pool shutdown fail");
+ }
+ }
+
+ if (!checkScheduledExecutor.isShutdown()) {
+ try {
+ checkScheduledExecutor.shutdown();
+ if (!checkScheduledExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
+ log.info("wait scheduled thread pool shutdown timeout, it will shutdown immediately");
+ checkScheduledExecutor.shutdownNow();
+ }
+ } catch (InterruptedException e) {
+ log.warn("wait scheduled thread pool shutdown fail");
+ }
+ }
+ }
+
+ public ThreadPoolExecutor getExecutors() {
+ return executor;
+ }
+
+ public ScheduledThreadPoolExecutor getCheckExecutor() {
+ return checkScheduledExecutor;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DruidDataSource.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DruidDataSource.java
new file mode 100644
index 0000000000..fb26d44d30
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/DruidDataSource.java
@@ -0,0 +1,150 @@
+/*
+ * 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;
+
+
+import org.apache.eventmesh.admin.server.web.utils.EncryptUtil;
+import org.apache.eventmesh.admin.server.web.utils.ParamType;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Configuration
+@ComponentScan
+@Slf4j
+public class DruidDataSource {
+
+ @Value("${spring.datasource.url}")
+ private String dbUrl;
+
+ @Value("${spring.datasource.username}")
+ private String username;
+
+ @Value("${spring.datasource.password}")
+ private String password;
+
+ @Value("${spring.datasource.driver-class-name}")
+ private String driverClassName;
+
+ @Value("${spring.datasource.initialSize}")
+ private int initialSize;
+
+ @Value("${spring.datasource.minIdle}")
+ private int minIdle;
+
+ @Value("${spring.datasource.maxActive}")
+ private int maxActive;
+
+ @Value("${spring.datasource.maxWait}")
+ private int maxWait;
+
+ @Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
+ private int timeBetweenEvictionRunsMillis;
+
+ @Value("${spring.datasource.minEvictableIdleTimeMillis}")
+ private int minEvictableIdleTimeMillis;
+
+ @Value("${spring.datasource.validationQuery}")
+ private String validationQuery;
+
+ @Value("${spring.datasource.testWhileIdle}")
+ private boolean testWhileIdle;
+
+ @Value("${spring.datasource.testOnBorrow}")
+ private boolean testOnBorrow;
+
+ @Value("${spring.datasource.testOnReturn}")
+ private boolean testOnReturn;
+
+ @Value("${spring.datasource.poolPreparedStatements}")
+ private boolean poolPreparedStatements;
+
+ @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
+ private int maxPoolPreparedStatementPerConnectionSize;
+
+ @Value("${spring.datasource.filters}")
+ private String filters;
+
+ @Value("{spring.datasource.connectionProperties}")
+ private String connectionProperties;
+
+ @Value("${sysPubKey}")
+ private String sysPubKeyStr;
+
+ @Value("${appPrivKey}")
+ private String appPrivKeyStr;
+
+
+ @Bean
+ @Primary
+ public DataSource dataSource() throws Exception {
+ try (com.alibaba.druid.pool.DruidDataSource datasource = new com.alibaba.druid.pool.DruidDataSource()) {
+ datasource.setUrl(this.dbUrl);
+ datasource.setUsername(username);
+ datasource.setPassword(rsaDecrypt(sysPubKeyStr, appPrivKeyStr, password));
+ datasource.setDriverClassName(driverClassName);
+ datasource.setInitialSize(initialSize);
+ datasource.setMinIdle(minIdle);
+ datasource.setMaxActive(maxActive);
+ datasource.setMaxWait(maxWait);
+ datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+ datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+ datasource.setValidationQuery(validationQuery);
+ datasource.setTestWhileIdle(testWhileIdle);
+ datasource.setTestOnBorrow(testOnBorrow);
+ datasource.setTestOnReturn(testOnReturn);
+ datasource.setPoolPreparedStatements(poolPreparedStatements);
+ datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
+ try {
+ datasource.setFilters(filters);
+ } catch (SQLException e) {
+ log.error("druid configuration initialization filter", e);
+ }
+ datasource.setConnectionProperties(connectionProperties);
+
+ return datasource;
+ }
+ }
+
+ public static String rsaDecrypt(String sysPubKeyStr, String appPrivKeyStr, String encrtyptText) throws IOException {
+ if (StringUtils.isNotBlank(encrtyptText) && encrtyptText.length() > "{RSA}".length() && encrtyptText.startsWith("{RSA}")) {
+ String text = encrtyptText.startsWith("{RSA}") ? encrtyptText.substring("{RSA}".length()) : encrtyptText;
+
+ try {
+ return EncryptUtil.decrypt(ParamType.STRING, sysPubKeyStr, ParamType.STRING, appPrivKeyStr, ParamType.STRING, text);
+ } catch (Exception e) {
+ throw new RuntimeException("decrypt error", e);
+ }
+ } else {
+ return encrtyptText;
+ }
+ }
+
+}
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
new file mode 100644
index 0000000000..e6e328984c
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshDataSource.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_data_source
+ */
+@TableName(value = "event_mesh_data_source")
+@Data
+public class EventMeshDataSource implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String dataType;
+
+ private String description;
+
+ private String configuration;
+
+ private String configurationClass;
+
+ private String region;
+
+ 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/EventMeshJobInfo.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java
new file mode 100644
index 0000000000..a77eaaaca2
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshJobInfo.java
@@ -0,0 +1,69 @@
+/*
+ * 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_job_info
+ */
+@TableName(value = "event_mesh_job_info")
+@Data
+public class EventMeshJobInfo implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String jobID;
+
+ private String jobDesc;
+
+ private String taskID;
+
+ private String transportType;
+
+ private Integer sourceData;
+
+ private Integer targetData;
+
+ private String jobState;
+
+ private String jobType;
+
+ // job request from region
+ private String fromRegion;
+
+ // job actually running region
+ private String runningRegion;
+
+ 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/EventMeshMonitor.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMonitor.java
new file mode 100644
index 0000000000..0507464b5b
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMonitor.java
@@ -0,0 +1,52 @@
+/*
+ * 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_monitor
+ */
+@TableName(value = "event_mesh_monitor")
+@Data
+public class EventMeshMonitor implements Serializable {
+
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String taskID;
+ private String jobID;
+ private String address;
+ private String transportType;
+ private String connectorStage;
+ private Long totalReqNum;
+ private Long totalTimeCost;
+ private Long maxTimeCost;
+ private Long avgTimeCost;
+ private Double tps;
+ 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/entity/EventMeshMysqlPosition.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java
new file mode 100644
index 0000000000..5e5d5745c1
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshMysqlPosition.java
@@ -0,0 +1,59 @@
+/*
+ * 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_mysql_position
+ */
+@TableName(value = "event_mesh_mysql_position")
+@Data
+public class EventMeshMysqlPosition implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String jobID;
+
+ private String serverUUID;
+
+ private String address;
+
+ private Long position;
+
+ private String gtid;
+
+ private String currentGtid;
+
+ private Long timestamp;
+
+ private String journalName;
+
+ 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/EventMeshPositionReporterHistory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java
new file mode 100644
index 0000000000..8518c38918
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshPositionReporterHistory.java
@@ -0,0 +1,47 @@
+/*
+ * 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_position_reporter_history
+ */
+@TableName(value = "event_mesh_position_reporter_history")
+@Data
+public class EventMeshPositionReporterHistory implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ private String job;
+
+ private String record;
+
+ private String address;
+
+ 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/entity/EventMeshRuntimeHeartbeat.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java
new file mode 100644
index 0000000000..95e6c5e261
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHeartbeat.java
@@ -0,0 +1,51 @@
+/*
+ * 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_runtime_heartbeat
+ */
+@TableName(value = "event_mesh_runtime_heartbeat")
+@Data
+public class EventMeshRuntimeHeartbeat implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ private String adminAddr;
+
+ private String runtimeAddr;
+
+ private String jobID;
+
+ private String reportTime;
+
+ private Date updateTime;
+
+ 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/entity/EventMeshRuntimeHistory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java
new file mode 100644
index 0000000000..ea7e10cbad
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshRuntimeHistory.java
@@ -0,0 +1,45 @@
+/*
+ * 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_runtime_history
+ */
+@TableName(value = "event_mesh_runtime_history")
+@Data
+public class EventMeshRuntimeHistory implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ private String job;
+
+ private String address;
+
+ 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/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..2d40f4a082
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshTaskInfo.java
@@ -0,0 +1,59 @@
+/*
+ * 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 taskName;
+
+ private String taskDesc;
+
+ private String taskState;
+
+ private String sourceRegion;
+
+ private String targetRegion;
+
+ 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..c5a6c35f8d
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshVerify.java
@@ -0,0 +1,56 @@
+/*
+ * 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 jobID;
+
+ 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/entity/EventMeshWeredisPosition.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshWeredisPosition.java
new file mode 100644
index 0000000000..2117230826
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/entity/EventMeshWeredisPosition.java
@@ -0,0 +1,59 @@
+/*
+ * 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_weredis_position
+ */
+@TableName(value = "event_mesh_weredis_position")
+@Data
+public class EventMeshWeredisPosition implements Serializable {
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ private String jobID;
+
+ // connection run address
+ private String address;
+
+ private String clusterName;
+
+ private String partitionName;
+
+ private String masterReplid;
+
+ //weredis run host
+ private String host;
+
+ private Long replOffset = -1L;
+
+ 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/mapper/EventMeshDataSourceMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshDataSourceMapper.java
new file mode 100644
index 0000000000..c59e28428f
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshDataSourceMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshDataSource;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table 'event_mesh_data_source' db operation
+ * 2024-05-09 15:52:49
+ * entity.db.web.server.admin.eventmesh.apache.org.EventMeshDataSource
+ */
+@Mapper
+public interface EventMeshDataSourceMapper extends BaseMapper {
+
+}
+
+
+
+
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..c04c4e3748
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoExtMapper.java
@@ -0,0 +1,54 @@
+/*
+ * 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.Param;
+
+import java.util.List;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * etx operator for table event_mesh_job_info
+ */
+@Mapper
+public interface EventMeshJobInfoExtMapper extends BaseMapper {
+
+ @Insert("")
+ @Transactional(rollbackFor = Exception.class)
+ 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
new file mode 100644
index 0000000000..39f8a4aed6
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshJobInfoMapper.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.EventMeshJobInfo;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table 'event_mesh_job_info' db operation
+ * entity org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo
+ */
+@Mapper
+public interface EventMeshJobInfoMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMonitorMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMonitorMapper.java
new file mode 100644
index 0000000000..db77224637
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMonitorMapper.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.EventMeshMonitor;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * event_mesh_monitor
+ * Entity org.apache.eventmesh.admin.server.web.db.entity.EventMeshMonitor
+ */
+@Mapper
+public interface EventMeshMonitorMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMysqlPositionMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMysqlPositionMapper.java
new file mode 100644
index 0000000000..f0a0467d76
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshMysqlPositionMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshMysqlPosition;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table `event_mesh_mysql_position` db operation
+ * 2024-05-14 17:15:03
+ * entity.db.web.server.admin.eventmesh.apache.org.EventMeshMysqlPosition
+ */
+@Mapper
+public interface EventMeshMysqlPositionMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshPositionReporterHistoryMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshPositionReporterHistoryMapper.java
new file mode 100644
index 0000000000..adc6723b79
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshPositionReporterHistoryMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshPositionReporterHistory;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table 'event_mesh_position_reporter_history' db operation
+ * 2024-05-14 17:15:03
+ * entity.db.web.server.admin.eventmesh.apache.org.EventMeshPositionReporterHistory
+ */
+@Mapper
+public interface EventMeshPositionReporterHistoryMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHeartbeatMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHeartbeatMapper.java
new file mode 100644
index 0000000000..813769d2ab
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHeartbeatMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshRuntimeHeartbeat;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table 'event_mesh_runtime_heartbeat' db operation
+ * 2024-05-14 17:15:03
+ * entity.db.web.server.admin.eventmesh.apache.org.EventMeshRuntimeHeartbeat
+ */
+@Mapper
+public interface EventMeshRuntimeHeartbeatMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHistoryMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHistoryMapper.java
new file mode 100644
index 0000000000..5fc3a21f54
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshRuntimeHistoryMapper.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshRuntimeHistory;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * for table 'event_mesh_runtime_history' db operation
+ * 2024-05-14 17:15:03
+ * entity.db.web.server.admin.eventmesh.apache.org.EventMeshRuntimeHistory
+ */
+@Mapper
+public interface EventMeshRuntimeHistoryMapper extends BaseMapper {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.java
new file mode 100644
index 0000000000..d1d472b8c4
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/mapper/EventMeshTaskInfoMapper.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.EventMeshTaskInfo;
+
+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 {
+
+}
+
+
+
+
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-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshDataSourceService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshDataSourceService.java
new file mode 100644
index 0000000000..29e2b8122e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshDataSourceService.java
@@ -0,0 +1,31 @@
+/*
+ * 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.EventMeshDataSource;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+*
+* for table 'event_mesh_data_source' db operation
+* 2024-05-09 15:52:49
+*/
+public interface EventMeshDataSourceService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.java
new file mode 100644
index 0000000000..22fc5ae299
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoExtService.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.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
new file mode 100644
index 0000000000..572e451ceb
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshJobInfoService.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.EventMeshJobInfo;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 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/EventMeshMonitorService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshMonitorService.java
new file mode 100644
index 0000000000..4180f82a97
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshMonitorService.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.EventMeshMonitor;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * event_mesh_monitor
+ */
+public interface EventMeshMonitorService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshMysqlPositionService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshMysqlPositionService.java
new file mode 100644
index 0000000000..2bf34ab922
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshMysqlPositionService.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.EventMeshMysqlPosition;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* for table 'event_mesh_mysql_position' db operation
+* 2024-05-14 17:15:03
+*/
+public interface EventMeshMysqlPositionService extends IService {
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshPositionReporterHistoryService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshPositionReporterHistoryService.java
new file mode 100644
index 0000000000..976eec94ea
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshPositionReporterHistoryService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.EventMeshPositionReporterHistory;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* for table 'event_mesh_position_reporter_history' db operation
+* 2024-05-14 17:15:03
+*/
+public interface EventMeshPositionReporterHistoryService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHeartbeatService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHeartbeatService.java
new file mode 100644
index 0000000000..f0e5d1c61b
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHeartbeatService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.EventMeshRuntimeHeartbeat;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * for table 'event_mesh_runtime_heartbeat' db operation
+ * 2024-05-14 17:15:03
+ */
+public interface EventMeshRuntimeHeartbeatService extends IService {
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHistoryService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHistoryService.java
new file mode 100644
index 0000000000..1f6db0e12e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshRuntimeHistoryService.java
@@ -0,0 +1,30 @@
+/*
+ * 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.EventMeshRuntimeHistory;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * for table 'event_mesh_runtime_history' db operation
+ * 2024-05-14 17:15:03
+ */
+public interface EventMeshRuntimeHistoryService 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..04da6a7952
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshTaskInfoService.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.service;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
+import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * event_mesh_task_info
+ */
+public interface EventMeshTaskInfoService extends IService {
+
+ List queryTaskInfo(QueryTaskInfoRequest taskInfoRequest);
+
+ // boolean deleteTaskByTaskID(String taskID);
+
+}
diff --git a/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java
similarity index 71%
rename from eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java
rename to eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java
index 8239dfcb6e..97f2d7268e 100644
--- a/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshVerifyService.java
@@ -1,32 +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.transformer;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-/**
- * EventMesh transformer interface, specified transformer implementation includes:
- * 1. Constant
- * 2. Original
- * 3. Template
- */
-public interface Transformer {
-
- String transform(String json) throws JsonProcessingException;
-
-}
+/*
+ * 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/web/db/service/impl/EventMeshDataSourceServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshDataSourceServiceImpl.java
new file mode 100644
index 0000000000..f703425c94
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshDataSourceServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.EventMeshDataSource;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshDataSourceMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshDataSourceService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * for table 'event_mesh_data_source' db operation
+ * 2024-05-09 15:52:49
+ */
+@Service
+public class EventMeshDataSourceServiceImpl extends ServiceImpl
+ implements EventMeshDataSourceService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java
new file mode 100644
index 0000000000..6cf0ebf6b2
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoExtServiceImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshJobInfoExtMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoExtService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EventMeshJobInfoExtServiceImpl implements EventMeshJobInfoExtService {
+ @Autowired
+ EventMeshJobInfoExtMapper mapper;
+
+ @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
new file mode 100644
index 0000000000..4613e0809d
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshJobInfoServiceImpl.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.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshJobInfoMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * event_mesh_job_info
+ */
+@Service
+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/EventMeshMonitorServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshMonitorServiceImpl.java
new file mode 100644
index 0000000000..ebb4220000
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshMonitorServiceImpl.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.EventMeshMonitor;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshMonitorMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshMonitorService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * event_mesh_monitor
+ */
+@Service
+public class EventMeshMonitorServiceImpl extends ServiceImpl
+ implements EventMeshMonitorService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshMysqlPositionServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshMysqlPositionServiceImpl.java
new file mode 100644
index 0000000000..353443b78d
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshMysqlPositionServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.EventMeshMysqlPosition;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshMysqlPositionMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshMysqlPositionService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * for table 'event_mesh_mysql_position' db operation
+ * 2024-05-14 17:15:03
+ */
+@Service
+@Slf4j
+public class EventMeshMysqlPositionServiceImpl extends ServiceImpl
+ implements EventMeshMysqlPositionService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshPositionReporterHistoryServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshPositionReporterHistoryServiceImpl.java
new file mode 100644
index 0000000000..d546e412ba
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshPositionReporterHistoryServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.EventMeshPositionReporterHistory;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshPositionReporterHistoryMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshPositionReporterHistoryService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * for table 'event_mesh_position_reporter_history' db operation
+ * 2024-05-14 17:15:03
+ */
+@Service
+public class EventMeshPositionReporterHistoryServiceImpl extends ServiceImpl
+ implements EventMeshPositionReporterHistoryService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHeartbeatServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHeartbeatServiceImpl.java
new file mode 100644
index 0000000000..452569e3a6
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHeartbeatServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.EventMeshRuntimeHeartbeat;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshRuntimeHeartbeatMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshRuntimeHeartbeatService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * for table 'event_mesh_runtime_heartbeat' db operation
+ * 2024-05-14 17:15:03
+ */
+@Service
+@Slf4j
+public class EventMeshRuntimeHeartbeatServiceImpl extends ServiceImpl
+ implements EventMeshRuntimeHeartbeatService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHistoryServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHistoryServiceImpl.java
new file mode 100644
index 0000000000..d39e868ce5
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshRuntimeHistoryServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.EventMeshRuntimeHistory;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshRuntimeHistoryMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshRuntimeHistoryService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * for table 'event_mesh_runtime_history' db operation
+ * 2024-05-14 17:15:03
+ */
+@Service
+public class EventMeshRuntimeHistoryServiceImpl extends ServiceImpl
+ implements EventMeshRuntimeHistoryService {
+
+}
+
+
+
+
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..91acb51a76
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshTaskInfoServiceImpl.java
@@ -0,0 +1,323 @@
+/*
+ * 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.EventMeshDataSource;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshMysqlPosition;
+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.EventMeshDataSourceService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshMysqlPositionService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+import org.apache.eventmesh.common.remote.JobState;
+import org.apache.eventmesh.common.remote.TaskState;
+import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
+import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * event_mesh_task_info
+ */
+@Slf4j
+@Service
+public class EventMeshTaskInfoServiceImpl extends ServiceImpl
+ implements EventMeshTaskInfoService {
+
+ @Autowired
+ private EventMeshTaskInfoMapper taskInfoMapper;
+
+ @Autowired
+ private EventMeshJobInfoService jobInfoService;
+
+ @Autowired
+ private EventMeshDataSourceService dataSourceService;
+
+ @Autowired
+ private EventMeshMysqlPositionService mysqlPositionService;
+
+ @Override
+ public List queryTaskInfo(QueryTaskInfoRequest taskInfoRequest) {
+
+ log.info("receive query task info request:{}", taskInfoRequest);
+
+ List queryTaskInfoResponseList = new ArrayList<>();
+
+ Integer currentPage = taskInfoRequest.getCurrentPage();
+ Integer pageSize = taskInfoRequest.getPageSize();
+
+ // query by page
+ if (StringUtils.isEmpty(taskInfoRequest.getTaskID())
+ && currentPage != null
+ && pageSize != null) {
+
+ Page page = new Page<>();
+ page.setCurrent(currentPage);
+ page.setSize(pageSize);
+ List eventMeshTaskInfoList = taskInfoMapper.selectPage(page, Wrappers.query()
+ .ne("taskState", TaskState.DELETE.name())).getRecords();
+ queryTaskInfoResponseList = getQueryTaskInfoResponses(eventMeshTaskInfoList, queryTaskInfoResponseList);
+
+ }
+
+ if (StringUtils.isNotEmpty(taskInfoRequest.getTaskID()) || StringUtils.isNotEmpty(taskInfoRequest.getTaskID())) {
+ queryTaskInfoResponseList = eventMeshTaskInfoList(taskInfoRequest);
+ }
+
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getJobType())) {
+ //
+ // }
+ //
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getSourceDataID())) {
+ //
+ // }
+ //
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getTargetDataID())) {
+ //
+ // }
+ //
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getIp())) {
+ //
+ // }
+ //
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getSourceTableName())) {
+ //
+ // }
+ //
+ // if (StringUtils.isNotEmpty(taskInfoRequest.getTaskMathID())) {
+ //
+ // }
+
+ log.info("query event mesh task info response result:{}", queryTaskInfoResponseList);
+
+ return queryTaskInfoResponseList;
+ }
+
+ @Transactional
+ private List eventMeshTaskInfoList(QueryTaskInfoRequest taskInfoRequest) {
+
+ List eventMeshTaskInfoList = new ArrayList<>();
+
+ Page page = new Page<>();
+ page.setCurrent(taskInfoRequest.getCurrentPage());
+ page.setSize(taskInfoRequest.getPageSize());
+
+ if (StringUtils.isNotEmpty(taskInfoRequest.getTaskID())) {
+ eventMeshTaskInfoList = taskInfoMapper.selectPage(page, Wrappers.query()
+ .eq("taskID", taskInfoRequest.getTaskID())
+ .ne("taskState", TaskState.DELETE.name()))
+ .getRecords();
+ }
+
+ if (StringUtils.isNotEmpty(taskInfoRequest.getTaskDesc())) {
+ eventMeshTaskInfoList = taskInfoMapper.selectPage(page, Wrappers.query()
+ .like("taskDesc", taskInfoRequest.getTaskDesc())
+ .ne("jobState", JobState.DELETE.name()))
+ .getRecords();
+ }
+
+ List eventMeshTaskInfos = new ArrayList<>();
+
+ List queryTaskInfoResponse = getQueryTaskInfoResponses(eventMeshTaskInfoList, eventMeshTaskInfos);
+ log.info("query task info result queryTaskInfoResponse:{}", queryTaskInfoResponse);
+
+ return queryTaskInfoResponse;
+ }
+
+ private List getQueryTaskInfoResponses(List eventMeshTaskInfoList,
+ List eventMeshTaskInfos) {
+
+ for (EventMeshTaskInfo meshTaskInfo : eventMeshTaskInfoList) {
+ QueryTaskInfoResponse eventMeshTaskInfo = initEventMeshTaskInfo(meshTaskInfo);
+ eventMeshTaskInfos.add(eventMeshTaskInfo);
+ }
+
+ if (!eventMeshTaskInfoList.isEmpty()) {
+ List eventMeshJobInfoList = new ArrayList<>();
+ for (QueryTaskInfoResponse eventMeshTaskInfo : eventMeshTaskInfos) {
+ List eventMeshJobInfos = jobInfoService.list(Wrappers.query()
+ .eq("taskID", eventMeshTaskInfo.getTaskID())
+ .ne("jobState", JobState.DELETE.name()));
+
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfos) {
+ QueryTaskInfoResponse.EventMeshJobInfo eventMeshJobInfoCovert = initEventMeshJobInfo(eventMeshJobInfo);
+ eventMeshJobInfoList.add(eventMeshJobInfoCovert);
+ }
+
+ if (!eventMeshJobInfoList.isEmpty()) {
+ for (QueryTaskInfoResponse.EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfoList) {
+ QueryTaskInfoResponse.EventMeshDataSource dataSource = covertEventMeshDataSource(
+ querySourceOrSinkData(eventMeshJobInfo.getSourceData()));
+ QueryTaskInfoResponse.EventMeshDataSource dataSink = covertEventMeshDataSource(
+ querySourceOrSinkData(eventMeshJobInfo.getTargetData()));
+
+ EventMeshMysqlPosition eventMeshMysqlPosition = mysqlPositionService.getOne(Wrappers.query().eq(
+ "jobID",
+ eventMeshJobInfo.getJobID()
+ ));
+
+
+ QueryTaskInfoResponse.EventMeshMysqlPosition mysqlPosition = covertEventMeshMysqlPosition(eventMeshMysqlPosition);
+
+ eventMeshJobInfo.setEventMeshMysqlPosition(mysqlPosition);
+ eventMeshJobInfo.setDataSource(dataSource);
+ eventMeshJobInfo.setDataSink(dataSink);
+ }
+ }
+
+ // set job info to same taskID
+ eventMeshTaskInfo.setEventMeshJobInfoList(eventMeshJobInfoList);
+ }
+ }
+
+ List queryTaskInfoResponse = new ArrayList<>();
+ if (!eventMeshTaskInfos.isEmpty()) {
+ queryTaskInfoResponse.addAll(eventMeshTaskInfos);
+ }
+
+ return queryTaskInfoResponse;
+ }
+
+ /**
+ * QueryTaskInfoResponse.EventMeshDataSource covert
+ *
+ * @param eventMeshData EventMeshDataSource
+ * @return meshData
+ */
+ private static QueryTaskInfoResponse.EventMeshDataSource covertEventMeshDataSource(EventMeshDataSource eventMeshData) {
+ QueryTaskInfoResponse.EventMeshDataSource meshData = new QueryTaskInfoResponse.EventMeshDataSource();
+ if (ObjectUtils.isEmpty(eventMeshData)) {
+ return null;
+ }
+ meshData.setId(eventMeshData.getId());
+ meshData.setDataType(eventMeshData.getDataType());
+ meshData.setConfiguration(eventMeshData.getConfiguration());
+ meshData.setConfigurationClass(eventMeshData.getConfigurationClass());
+ meshData.setDescription(eventMeshData.getDescription());
+ meshData.setRegion(eventMeshData.getRegion());
+ meshData.setCreateUid(eventMeshData.getCreateUid());
+ meshData.setUpdateUid(eventMeshData.getUpdateUid());
+ meshData.setCreateTime(eventMeshData.getCreateTime());
+ meshData.setUpdateTime(eventMeshData.getUpdateTime());
+ return meshData;
+ }
+
+ /**
+ * getSourceOrSinkData
+ *
+ * @param id id
+ * @return EventMeshDataSource
+ */
+ private EventMeshDataSource querySourceOrSinkData(Integer id) {
+ return dataSourceService.getOne(Wrappers.query().eq(
+ "id",
+ id));
+ }
+
+ /**
+ * QueryTaskInfoResponse.EventMeshMysqlPosition
+ *
+ * @param mysqlPosition EventMeshMysqlPosition
+ * @return position
+ */
+ private static QueryTaskInfoResponse.EventMeshMysqlPosition covertEventMeshMysqlPosition(EventMeshMysqlPosition mysqlPosition) {
+ QueryTaskInfoResponse.EventMeshMysqlPosition position = new QueryTaskInfoResponse.EventMeshMysqlPosition();
+ if (ObjectUtils.isEmpty(mysqlPosition)) {
+ return null;
+ }
+ position.setId(mysqlPosition.getId());
+ position.setJobID(mysqlPosition.getJobID());
+ position.setServerUUID(mysqlPosition.getServerUUID());
+ position.setAddress(mysqlPosition.getAddress());
+ position.setPosition(mysqlPosition.getPosition());
+ position.setGtid(mysqlPosition.getGtid());
+ position.setCurrentGtid(mysqlPosition.getCurrentGtid());
+ position.setTimestamp(mysqlPosition.getTimestamp());
+ position.setJournalName(mysqlPosition.getJournalName());
+ position.setCreateTime(mysqlPosition.getCreateTime());
+ position.setUpdateTime(mysqlPosition.getUpdateTime());
+ return position;
+ }
+
+ /**
+ * EventMeshJobInfo covert
+ *
+ * @param eventMeshJobInfo EventMeshJobInfo
+ * @return QueryTaskInfoResponse.EventMeshJobInfo
+ */
+ private static QueryTaskInfoResponse.EventMeshJobInfo initEventMeshJobInfo(EventMeshJobInfo eventMeshJobInfo) {
+ QueryTaskInfoResponse.EventMeshJobInfo eventMeshJobInfoCovert = new QueryTaskInfoResponse.EventMeshJobInfo();
+ if (ObjectUtils.isEmpty(eventMeshJobInfo)) {
+ return null;
+ }
+ eventMeshJobInfoCovert.setId(eventMeshJobInfo.getId());
+ eventMeshJobInfoCovert.setJobID(eventMeshJobInfo.getJobID());
+ eventMeshJobInfoCovert.setJobDesc(eventMeshJobInfo.getJobDesc());
+ eventMeshJobInfoCovert.setTaskID(eventMeshJobInfo.getTaskID());
+ eventMeshJobInfoCovert.setTransportType(eventMeshJobInfo.getTransportType());
+ eventMeshJobInfoCovert.setSourceData(eventMeshJobInfo.getSourceData());
+ eventMeshJobInfoCovert.setTargetData(eventMeshJobInfo.getTargetData());
+ eventMeshJobInfoCovert.setJobState(eventMeshJobInfo.getJobState());
+ eventMeshJobInfoCovert.setJobType(eventMeshJobInfo.getJobType());
+ eventMeshJobInfoCovert.setFromRegion(eventMeshJobInfo.getFromRegion());
+ eventMeshJobInfoCovert.setRunningRegion(eventMeshJobInfo.getRunningRegion());
+ eventMeshJobInfoCovert.setCreateUid(eventMeshJobInfo.getCreateUid());
+ eventMeshJobInfoCovert.setUpdateUid(eventMeshJobInfo.getUpdateUid());
+ eventMeshJobInfoCovert.setCreateTime(eventMeshJobInfo.getCreateTime());
+ eventMeshJobInfoCovert.setUpdateTime(eventMeshJobInfo.getUpdateTime());
+ return eventMeshJobInfoCovert;
+ }
+
+ /**
+ * EventMeshTaskInfo covert
+ *
+ * @param meshTaskInfo EventMeshTaskInfo
+ * @return QueryTaskInfoResponse
+ */
+ private static QueryTaskInfoResponse initEventMeshTaskInfo(EventMeshTaskInfo meshTaskInfo) {
+ QueryTaskInfoResponse eventMeshTaskInfo = new QueryTaskInfoResponse();
+ eventMeshTaskInfo.setId(meshTaskInfo.getId());
+ eventMeshTaskInfo.setTaskID(meshTaskInfo.getTaskID());
+ eventMeshTaskInfo.setTaskDesc(meshTaskInfo.getTaskDesc());
+ eventMeshTaskInfo.setTaskState(meshTaskInfo.getTaskState());
+ eventMeshTaskInfo.setSourceRegion(meshTaskInfo.getSourceRegion());
+ eventMeshTaskInfo.setTargetRegion(meshTaskInfo.getTargetRegion());
+ eventMeshTaskInfo.setCreateUid(meshTaskInfo.getCreateUid());
+ eventMeshTaskInfo.setUpdateUid(meshTaskInfo.getUpdateUid());
+ eventMeshTaskInfo.setCreateTime(meshTaskInfo.getCreateTime());
+ eventMeshTaskInfo.setUpdateTime(meshTaskInfo.getUpdateTime());
+ return eventMeshTaskInfo;
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshVerifyServiceImpl.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshVerifyServiceImpl.java
new file mode 100644
index 0000000000..5e49ba32ea
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshVerifyServiceImpl.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.EventMeshVerify;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshVerifyMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshVerifyService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * event_mesh_verify
+ */
+@Service
+public class EventMeshVerifyServiceImpl extends ServiceImpl
+ implements EventMeshVerifyService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/BaseRequestHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/BaseRequestHandler.java
new file mode 100644
index 0000000000..7f08f388c9
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/BaseRequestHandler.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.request.BaseRemoteRequest;
+import org.apache.eventmesh.common.remote.response.BaseRemoteResponse;
+
+public abstract class BaseRequestHandler {
+
+ public BaseRemoteResponse handlerRequest(T request, Metadata metadata) {
+ return handler(request, metadata);
+ }
+
+ protected abstract S handler(T request, Metadata metadata);
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/RequestHandlerFactory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/RequestHandlerFactory.java
new file mode 100644
index 0000000000..9375fb537e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/RequestHandlerFactory.java
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.common.remote.request.BaseRemoteRequest;
+import org.apache.eventmesh.common.remote.response.BaseRemoteResponse;
+
+import java.lang.reflect.ParameterizedType;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestHandlerFactory implements ApplicationListener {
+
+ private final Map> handlers =
+ new ConcurrentHashMap<>();
+
+ public BaseRequestHandler getHandler(String type) {
+ return handlers.get(type);
+ }
+
+ @Override
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public void onApplicationEvent(ContextRefreshedEvent event) {
+ Map beans =
+ event.getApplicationContext().getBeansOfType(BaseRequestHandler.class);
+
+ for (BaseRequestHandler requestHandler : beans.values()) {
+ Class> clazz = requestHandler.getClass();
+ boolean skip = false;
+ while (!clazz.getSuperclass().equals(BaseRequestHandler.class)) {
+ if (clazz.getSuperclass().equals(Object.class)) {
+ skip = true;
+ break;
+ }
+ clazz = clazz.getSuperclass();
+ }
+ if (skip) {
+ continue;
+ }
+
+ Class c = (Class) ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments()[0];
+ handlers.putIfAbsent(c.getSimpleName(), requestHandler);
+ }
+ }
+}
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
new file mode 100644
index 0000000000..3392084c28
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchJobRequestHandler.java
@@ -0,0 +1,67 @@
+/*
+ * 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.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;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class FetchJobRequestHandler extends BaseRequestHandler {
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @Override
+ public FetchJobResponse handler(FetchJobRequest request, Metadata metadata) {
+ if (StringUtils.isBlank(request.getJobID())) {
+ return FetchJobResponse.failResponse(ErrorCode.BAD_REQUEST, "job id is empty");
+ }
+ FetchJobResponse response = FetchJobResponse.successResponse();
+ JobDetail detail = jobInfoBizService.getJobDetail(request.getJobID());
+ if (detail == null) {
+ return response;
+ }
+ response.setId(detail.getJobID());
+ JobConnectorConfig config = new JobConnectorConfig();
+ config.setSourceConnectorConfig(JsonUtils.objectToMap(detail.getSourceDataSource().getConf()));
+ config.setSourceConnectorDesc(detail.getSourceConnectorDesc());
+ config.setSinkConnectorConfig(JsonUtils.objectToMap(detail.getSinkDataSource().getConf()));
+ config.setSinkConnectorDesc(detail.getSinkConnectorDesc());
+ response.setConnectorConfig(config);
+ response.setTransportType(detail.getTransportType());
+ response.setState(detail.getState());
+ 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
new file mode 100644
index 0000000000..85ef0e6113
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/FetchPositionHandler.java
@@ -0,0 +1,55 @@
+/*
+ * 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.db.DBThreadPool;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+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;
+import org.apache.eventmesh.common.remote.response.FetchPositionResponse;
+
+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 FetchPositionHandler extends BaseRequestHandler {
+
+ @Autowired
+ DBThreadPool executor;
+
+ @Autowired
+ PositionBizService positionBizService;
+
+ @Override
+ protected FetchPositionResponse handler(FetchPositionRequest request, Metadata metadata) {
+ if (request.getDataSourceType() == null) {
+ return FetchPositionResponse.failResponse(ErrorCode.BAD_REQUEST, "illegal data type, it's empty");
+ }
+ if (StringUtils.isBlank(request.getJobID())) {
+ return FetchPositionResponse.failResponse(ErrorCode.BAD_REQUEST, "illegal job id, it's empty");
+ }
+ return FetchPositionResponse.successResponse(positionBizService.getPosition(request, metadata));
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportHeartBeatHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportHeartBeatHandler.java
new file mode 100644
index 0000000000..26a9b430b7
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportHeartBeatHandler.java
@@ -0,0 +1,70 @@
+/*
+ * 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.db.DBThreadPool;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHeartbeat;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.service.heatbeat.RuntimeHeartbeatBizService;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.request.ReportHeartBeatRequest;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+import org.apache.eventmesh.common.utils.IPUtils;
+
+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 ReportHeartBeatHandler extends BaseRequestHandler {
+
+ @Autowired
+ RuntimeHeartbeatBizService heartbeatBizService;
+
+ @Autowired
+ DBThreadPool executor;
+
+ @Override
+ 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();
+ heartbeat.setJobID(request.getJobID());
+ heartbeat.setReportTime(request.getReportedTimeStamp());
+ heartbeat.setAdminAddr(IPUtils.getLocalAddress());
+ heartbeat.setRuntimeAddr(request.getAddress());
+ try {
+ if (!heartbeatBizService.saveOrUpdateByRuntimeAddress(heartbeat)) {
+ log.warn("save or update heartbeat request [{}] fail", request);
+ }
+ } catch (Exception e) {
+ log.warn("save or update heartbeat request [{}] fail", request, e);
+ }
+ });
+
+ return SimpleResponse.success();
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportJobRequestHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportJobRequestHandler.java
new file mode 100644
index 0000000000..c876014f63
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportJobRequestHandler.java
@@ -0,0 +1,104 @@
+/*
+ * 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.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.pojo.TaskDetail;
+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.JobState;
+import org.apache.eventmesh.common.remote.TransportType;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+import org.apache.eventmesh.common.remote.request.RecordPositionRequest;
+import org.apache.eventmesh.common.remote.request.ReportJobRequest;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+@Component
+@Slf4j
+public class ReportJobRequestHandler extends BaseRequestHandler {
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @Autowired
+ PositionBizService positionBizService;
+
+ @Override
+ public SimpleResponse handler(ReportJobRequest request, Metadata metadata) {
+ log.info("receive report job request:{}", request);
+ if (StringUtils.isBlank(request.getJobID())) {
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal job id, it's empty");
+ }
+ EventMeshJobInfo jobInfo = jobInfoBizService.getJobInfo(request.getJobID());
+ if (jobInfo == null) {
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal job id, not exist target job,jobID:" + request.getJobID());
+ }
+ boolean recordResult = recordPosition(request, metadata, jobInfo);
+ boolean result = recordResult && jobInfoBizService.updateJobState(jobInfo.getJobID(), request.getState());
+ if (result) {
+ return SimpleResponse.success();
+ } else {
+ return SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "update job failed.");
+ }
+ }
+
+ private boolean recordPosition(ReportJobRequest request, Metadata metadata, EventMeshJobInfo jobInfo) {
+ if (!jobInfo.getJobState().equalsIgnoreCase(JobState.INIT.name()) || !JobState.RUNNING.name().equalsIgnoreCase(request.getState().name())) {
+ log.info("skip record position because of job state not from init change to running.jobID:{}", jobInfo.getJobID());
+ return true;
+ }
+
+ TaskDetail taskDetail = jobInfoBizService.getTaskDetail(jobInfo.getTaskID(), DataSourceType.MYSQL);
+ if (taskDetail.getFullTask() == null || taskDetail.getIncreaseTask() == null) {
+ log.info("skip record position because of not exist full and increase job.jobID:{}", jobInfo.getJobID());
+ return true;
+ }
+
+ List recordPositionList =
+ positionBizService.getPositionByJobID(taskDetail.getIncreaseTask().getJobID(), DataSourceType.MYSQL);
+ if (!recordPositionList.isEmpty()) {
+ log.info("skip record position because of increase job has exist position.jobID:{},position list size:{}", jobInfo.getJobID(),
+ recordPositionList.size());
+ return true;
+ }
+
+ RecordPositionRequest recordPositionRequest = new RecordPositionRequest();
+ recordPositionRequest.setFullJobID(taskDetail.getFullTask().getJobID());
+ recordPositionRequest.setIncreaseJobID(taskDetail.getIncreaseTask().getJobID());
+ recordPositionRequest.setUpdateState(request.getState());
+ recordPositionRequest.setAddress(request.getAddress());
+ TransportType currentTransportType = TransportType.getTransportType(jobInfo.getTransportType());
+ recordPositionRequest.setDataSourceType(currentTransportType.getSrc());
+ return positionBizService.recordPosition(recordPositionRequest, metadata);
+ }
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportMonitorHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportMonitorHandler.java
new file mode 100644
index 0000000000..a36939bb88
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportMonitorHandler.java
@@ -0,0 +1,97 @@
+/*
+ * 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.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.service.job.JobInfoBizService;
+import org.apache.eventmesh.admin.server.web.service.monitor.MonitorBizService;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.request.ReportMonitorRequest;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class ReportMonitorHandler extends BaseRequestHandler {
+
+ @Autowired
+ private MonitorBizService monitorService;
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @Autowired
+ private AdminServerProperties properties;
+
+ @Override
+ protected SimpleResponse handler(ReportMonitorRequest request, Metadata metadata) {
+ if (StringUtils.isAnyBlank(request.getTaskID(), request.getJobID(), request.getAddress())) {
+ log.info("report monitor request [{}] illegal", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "request task id,job id or address is none");
+ }
+
+ String jobID = request.getJobID();
+ EventMeshJobInfo jobInfo = jobInfoBizService.getJobInfo(jobID);
+ if (jobInfo == null || StringUtils.isBlank(jobInfo.getFromRegion())) {
+ log.info("report monitor job info [{}] illegal", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "job info is null or fromRegion is blank,job id:" + jobID);
+ }
+ String fromRegion = jobInfo.getFromRegion();
+ String transportType = jobInfo.getTransportType();
+ if (StringUtils.isEmpty(request.getTransportType())) {
+ request.setTransportType(transportType);
+ }
+ String localRegion = properties.getRegion();
+ log.info("report monitor request from region:{},localRegion:{},request:{}", fromRegion, localRegion, request);
+ if (fromRegion.equalsIgnoreCase(localRegion)) {
+ return monitorService.reportMonitorRecord(request) ? SimpleResponse.success() :
+ SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "save monitor "
+ + "request fail");
+ } else {
+ List adminServerList = Arrays.asList(properties.getAdminServerList().get(fromRegion).split(";"));
+ if (adminServerList == null || adminServerList.isEmpty()) {
+ throw new RuntimeException("No admin server available for region: " + fromRegion);
+ }
+ String targetUrl = adminServerList.get(new Random().nextInt(adminServerList.size())) + "/eventmesh/admin/reportMonitor";
+ log.info("start transfer monitor request to from region admin server. from region:{}, targetUrl:{}", fromRegion, targetUrl);
+ RestTemplate restTemplate = new RestTemplate();
+ ResponseEntity response = restTemplate.postForEntity(targetUrl, request, String.class);
+ if (!response.getStatusCode().is2xxSuccessful()) {
+ log.error("transfer monitor request to from region admin server error. from region:{}, targetUrl:{}", fromRegion, targetUrl);
+ return SimpleResponse.fail(ErrorCode.INTERNAL_ERR,
+ "save monitor request fail,code:" + response.getStatusCode() + ",msg:" + response.getBody());
+ }
+ 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
new file mode 100644
index 0000000000..7a30bef80a
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportPositionHandler.java
@@ -0,0 +1,103 @@
+/*
+ * 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.db.DBThreadPool;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+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.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 ReportPositionHandler extends BaseRequestHandler {
+
+ @Autowired
+ private JobInfoBizService jobInfoBizService;
+
+ @Autowired
+ private DBThreadPool executor;
+
+ @Autowired
+ private PositionBizService positionBizService;
+
+ @Override
+ protected SimpleResponse handler(ReportPositionRequest request, Metadata metadata) {
+ log.info("receive report position request:{}", request);
+ 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) {
+ log.info("request [{}] illegal data type", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal data type, it's empty");
+ }
+ 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.getRecordPositionList() == null || request.getRecordPositionList().isEmpty()) {
+ log.info("request [{}] illegal record position", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "illegal record position list, it's empty");
+ }
+
+ positionBizService.isValidatePositionRequest(request.getDataSourceType());
+
+ executor.getExecutors().execute(() -> {
+ try {
+ boolean reported = positionBizService.reportPosition(request, metadata);
+ if (reported) {
+ if (log.isDebugEnabled()) {
+ log.debug("handle runtime [{}] report data type [{}] job [{}] position [{}] success",
+ request.getAddress(), request.getDataSourceType(), request.getJobID(),
+ request.getRecordPositionList());
+ }
+ } else {
+ log.warn("handle runtime [{}] report data type [{}] job [{}] position [{}] fail",
+ request.getAddress(), request.getDataSourceType(), request.getJobID(),
+ request.getRecordPositionList());
+ }
+ } catch (Exception e) {
+ log.warn("handle position request fail, request [{}]", request, e);
+ } finally {
+ try {
+ 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(),
+ request.getDataSourceType(), request.getState(), e);
+ }
+ }
+ });
+ 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..e7f1d1257f
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportVerifyHandler.java
@@ -0,0 +1,93 @@
+/*
+ * 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.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.service.job.JobInfoBizService;
+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 java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class ReportVerifyHandler extends BaseRequestHandler {
+
+ @Autowired
+ private VerifyBizService verifyService;
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @Autowired
+ private AdminServerProperties properties;
+
+ @Override
+ protected SimpleResponse handler(ReportVerifyRequest request, Metadata metadata) {
+ if (StringUtils.isAnyBlank(request.getTaskID(), request.getJobID(), request.getRecordSig(), request.getRecordID(),
+ request.getConnectorStage())) {
+ log.info("report verify request [{}] illegal", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "request task id,job id, sign, record id or stage is none");
+ }
+
+ String jobID = request.getJobID();
+ EventMeshJobInfo jobInfo = jobInfoBizService.getJobInfo(jobID);
+ if (jobInfo == null || StringUtils.isBlank(jobInfo.getFromRegion())) {
+ log.info("report verify job info [{}] illegal", request);
+ return SimpleResponse.fail(ErrorCode.BAD_REQUEST, "job info is null or fromRegion is blank,job id:" + jobID);
+ }
+
+ String fromRegion = jobInfo.getFromRegion();
+ String localRegion = properties.getRegion();
+ log.info("report verify request from region:{},localRegion:{},request:{}", fromRegion, localRegion, request);
+ if (fromRegion.equalsIgnoreCase(localRegion)) {
+ return verifyService.reportVerifyRecord(request) ? SimpleResponse.success() : SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "save verify "
+ + "request fail");
+ } else {
+ log.info("start transfer report verify to from region admin server. from region:{}", fromRegion);
+ List adminServerList = Arrays.asList(properties.getAdminServerList().get(fromRegion).split(";"));
+ if (adminServerList == null || adminServerList.isEmpty()) {
+ throw new RuntimeException("No admin server available for region: " + fromRegion);
+ }
+ String targetUrl = adminServerList.get(new Random().nextInt(adminServerList.size())) + "/eventmesh/admin/reportVerify";
+ RestTemplate restTemplate = new RestTemplate();
+ ResponseEntity response = restTemplate.postForEntity(targetUrl, request, String.class);
+ if (!response.getStatusCode().is2xxSuccessful()) {
+ return SimpleResponse.fail(ErrorCode.INTERNAL_ERR,
+ "save verify request fail,code:" + response.getStatusCode() + ",msg:" + response.getBody());
+ }
+ return SimpleResponse.success();
+ }
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/BinlogPosition.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/BinlogPosition.java
new file mode 100644
index 0000000000..5bd8daab10
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/BinlogPosition.java
@@ -0,0 +1,27 @@
+/*
+ * 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 lombok.Data;
+
+@Data
+public class BinlogPosition {
+ private String file;
+ private Long position;
+}
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..0e2fa64878
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/JobDetail.java
@@ -0,0 +1,70 @@
+/*
+ * 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 jobDesc;
+
+ private String taskID;
+
+ private TaskState state;
+
+ private JobType jobType;
+
+ private Date createTime;
+
+ private Date updateTime;
+
+ private String createUid;
+
+ private String updateUid;
+
+ // job request from region
+ private String fromRegion;
+
+ // job actually running region
+ private String runningRegion;
+
+ private DataSource sourceDataSource;
+
+ private String sourceConnectorDesc;
+
+ private DataSource sinkDataSource;
+
+ private String sinkConnectorDesc;
+
+ private TransportType transportType;
+
+ private List positions;
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
new file mode 100644
index 0000000000..2b174209e2
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
@@ -0,0 +1,34 @@
+/*
+ * 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.admin.server.web.db.entity.EventMeshJobInfo;
+
+import lombok.Data;
+
+/**
+ * Description:
+ */
+@Data
+public class TaskDetail {
+
+ private EventMeshJobInfo fullTask;
+
+ private EventMeshJobInfo increaseTask;
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java
new file mode 100644
index 0000000000..bc822ad6c3
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminGrpcServer.java
@@ -0,0 +1,104 @@
+/*
+ * 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;
+
+import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
+import org.apache.eventmesh.admin.server.web.handler.BaseRequestHandler;
+import org.apache.eventmesh.admin.server.web.handler.RequestHandlerFactory;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.AdminServiceGrpc;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Payload;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+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.SimpleResponse;
+
+import org.apache.commons.lang3.StringUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import io.grpc.stub.ServerCallStreamObserver;
+import io.grpc.stub.StreamObserver;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Service
+@Slf4j
+public class AdminGrpcServer extends AdminServiceGrpc.AdminServiceImplBase {
+
+ @Autowired
+ RequestHandlerFactory handlerFactory;
+
+ private Payload process(Payload value) {
+ if (value == null || StringUtils.isBlank(value.getMetadata().getType())) {
+ 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(SimpleResponse.fail(ErrorCode.BAD_REQUEST, "not match any request handler"));
+ }
+ BaseRemoteResponse response = handler.handlerRequest((BaseRemoteRequest) PayloadUtil.parse(value), value.getMetadata());
+ 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(SimpleResponse.fail(((AdminServerRuntimeException) e).getCode(), e.getMessage()));
+ }
+ return PayloadUtil.from(SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "admin server internal err"));
+ }
+ }
+
+ public StreamObserver invokeBiStream(StreamObserver responseObserver) {
+ return new StreamObserver() {
+ @Override
+ public void onNext(Payload value) {
+ Payload payload = process(value);
+ if (payload == null) {
+ return;
+ }
+ responseObserver.onNext(payload);
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ if (responseObserver instanceof ServerCallStreamObserver) {
+ if (!((ServerCallStreamObserver) responseObserver).isCancelled()) {
+ log.warn("admin gRPC server fail", t);
+ }
+ }
+ }
+
+ @Override
+ public void onCompleted() {
+ responseObserver.onCompleted();
+ }
+ };
+ }
+
+ public void invoke(Payload request, StreamObserver responseObserver) {
+ responseObserver.onNext(process(request));
+ responseObserver.onCompleted();
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java
new file mode 100644
index 0000000000..fd7582800d
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/AdminServer.java
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+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.exception.ErrorCode;
+import org.apache.eventmesh.common.utils.IPUtils;
+import org.apache.eventmesh.registry.RegisterServerInfo;
+import org.apache.eventmesh.registry.RegistryFactory;
+import org.apache.eventmesh.registry.RegistryService;
+
+import org.apache.commons.lang3.StringUtils;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.stereotype.Service;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Service
+@Slf4j
+public class AdminServer implements ComponentLifeCycle, ApplicationListener {
+ private final RegistryService registryService;
+
+ private final RegisterServerInfo adminServeInfo;
+
+ private final CommonConfiguration configuration;
+
+ public AdminServer(AdminServerProperties properties) {
+ configuration =
+ ConfigService.getInstance().buildConfigInstance(CommonConfiguration.class);
+ if (configuration == null) {
+ throw new AdminServerRuntimeException(ErrorCode.STARTUP_CONFIG_MISS, "common configuration file miss");
+ }
+ this.adminServeInfo = new RegisterServerInfo();
+
+ adminServeInfo.setHealth(true);
+ adminServeInfo.setAddress(IPUtils.getLocalAddress() + ":" + properties.getPort());
+ String name = Constants.ADMIN_SERVER_REGISTRY_NAME;
+ if (StringUtils.isNotBlank(properties.getServiceName())) {
+ name = properties.getServiceName();
+ }
+ adminServeInfo.setServiceName(name);
+ registryService = RegistryFactory.getInstance(configuration.getEventMeshRegistryPluginType());
+ }
+
+ @Override
+ @PostConstruct
+ public void start() {
+ if (configuration.isEventMeshRegistryPluginEnabled()) {
+ registryService.init();
+ }
+ }
+
+ @Override
+ public void stop() {
+ if (configuration.isEventMeshRegistryPluginEnabled()) {
+ registryService.unRegister(adminServeInfo);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException ignore) {
+ log.warn("interrupted when sleep");
+ Thread.currentThread().interrupt();
+ }
+ registryService.shutdown();
+ }
+ }
+
+ @Override
+ public void onApplicationEvent(ApplicationReadyEvent event) {
+ if (configuration.isEventMeshRegistryPluginEnabled()) {
+ log.info("application is started and registry plugin is enabled, it's will register admin self");
+ registryService.register(adminServeInfo);
+ }
+ }
+}
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..4d2d670100
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/datasource/DataSourceBizService.java
@@ -0,0 +1,50 @@
+/*
+ * 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.setConfigurationClass(dataSource.getConfigClass());
+ 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/RuntimeHeartbeatBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/RuntimeHeartbeatBizService.java
new file mode 100644
index 0000000000..95dff6e5b3
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/heatbeat/RuntimeHeartbeatBizService.java
@@ -0,0 +1,81 @@
+/*
+ * 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.heatbeat;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHeartbeat;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHistory;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshRuntimeHeartbeatService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshRuntimeHistoryService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * for table 'event_mesh_runtime_heartbeat' db operation 2024-05-14 17:15:03
+ */
+@Service
+@Slf4j
+public class RuntimeHeartbeatBizService {
+
+ @Autowired
+ EventMeshRuntimeHistoryService historyService;
+
+ @Autowired
+ EventMeshRuntimeHeartbeatService heartbeatService;
+
+ public boolean saveOrUpdateByRuntimeAddress(EventMeshRuntimeHeartbeat entity) {
+ EventMeshRuntimeHeartbeat old = heartbeatService.getOne(Wrappers.query().eq(
+ "runtimeAddr",
+ entity.getRuntimeAddr()));
+ if (old == null) {
+ return heartbeatService.save(entity);
+ } else {
+ if (Long.parseLong(old.getReportTime()) >= Long.parseLong(entity.getReportTime())) {
+ log.info("update heartbeat record ignore, current report time late than db, job [{}], remote [{}]", entity.getJobID(),
+ entity.getRuntimeAddr());
+ return true;
+ }
+ try {
+ return heartbeatService.update(entity, Wrappers.update().eq("updateTime",
+ old.getUpdateTime()));
+ } finally {
+ if (old.getJobID() != null && !old.getJobID().equals(entity.getJobID())) {
+ EventMeshRuntimeHistory history = new EventMeshRuntimeHistory();
+ history.setAddress(old.getAdminAddr());
+ history.setJob(old.getJobID());
+ try {
+ historyService.save(history);
+ } catch (Exception e) {
+ log.warn("save runtime job changed history fail", e);
+ }
+
+ log.info("runtime [{}] changed job, old job [{}], now [{}]", entity.getRuntimeAddr(), old.getJobID(),
+ entity.getJobID());
+ }
+ }
+ }
+ }
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/JobInfoBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/JobInfoBizService.java
new file mode 100644
index 0000000000..c200d9801a
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/JobInfoBizService.java
@@ -0,0 +1,302 @@
+/*
+ * 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.AdminServerProperties;
+import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
+import org.apache.eventmesh.admin.server.web.db.DBThreadPool;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshDataSource;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshRuntimeHeartbeat;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshDataSourceService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoExtService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshJobInfoService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshRuntimeHeartbeatService;
+import org.apache.eventmesh.admin.server.web.pojo.JobDetail;
+import org.apache.eventmesh.admin.server.web.pojo.TaskDetail;
+import org.apache.eventmesh.admin.server.web.service.datasource.DataSourceBizService;
+import org.apache.eventmesh.admin.server.web.service.position.PositionBizService;
+import org.apache.eventmesh.common.config.connector.Config;
+import org.apache.eventmesh.common.remote.JobState;
+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.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.job.JobType;
+import org.apache.eventmesh.common.remote.request.CreateOrUpdateDataSourceReq;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.time.Duration;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * for table 'event_mesh_job_info' db operation
+ */
+@Service
+@Slf4j
+public class JobInfoBizService {
+
+ @Autowired
+ private EventMeshJobInfoService jobInfoService;
+
+ @Autowired
+ private EventMeshJobInfoExtService jobInfoExtService;
+
+ @Autowired
+ private DataSourceBizService dataSourceBizService;
+
+ @Autowired
+ private EventMeshDataSourceService dataSourceService;
+
+ @Autowired
+ private PositionBizService positionBizService;
+
+ @Autowired
+ private AdminServerProperties properties;
+
+ @Autowired
+ EventMeshRuntimeHeartbeatService heartbeatService;
+
+ private final long heatBeatPeriod = Duration.ofMillis(5000).toMillis();
+
+ @Autowired
+ DBThreadPool executor;
+
+ @PostConstruct
+ public void init() {
+ log.info("init check job info scheduled task.");
+ executor.getCheckExecutor().scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ checkJobInfo();
+ }
+ }, 10, 10, TimeUnit.SECONDS);
+ }
+
+ public boolean updateJobState(String jobID, TaskState state) {
+ if (jobID == null || state == null) {
+ return false;
+ }
+ EventMeshJobInfo jobInfo = new EventMeshJobInfo();
+ jobInfo.setJobState(state.name());
+ return jobInfoService.update(jobInfo, Wrappers.update().eq("jobID", jobID).ne("jobState", JobState.DELETE.name()));
+ }
+
+ public boolean updateJobState(String jobID, JobState state) {
+ if (jobID == null || state == null) {
+ return false;
+ }
+ EventMeshJobInfo jobInfo = new EventMeshJobInfo();
+ jobInfo.setJobState(state.name());
+ return jobInfoService.update(jobInfo, Wrappers.update().eq("jobID", jobID).ne("jobState", JobState.DELETE.name()));
+ }
+
+ @Transactional
+ public List createJobs(List jobs) {
+ if (jobs == null || jobs.isEmpty() || jobs.stream().anyMatch(job -> StringUtils.isBlank(job.getTaskID()))) {
+ log.warn("when create jobs, task id is empty or jobs config is empty ");
+ return null;
+ }
+ List entityList = new LinkedList<>();
+
+ for (JobDetail job : jobs) {
+ // if running region not equal with admin region continue
+ if (!job.getRunningRegion().equals(properties.getRegion())) {
+ continue;
+ }
+ EventMeshJobInfo entity = new EventMeshJobInfo();
+ entity.setJobState(TaskState.INIT.name());
+ entity.setTaskID(job.getTaskID());
+ entity.setJobType(job.getJobType().name());
+ entity.setJobDesc(job.getJobDesc());
+ String jobID = UUID.randomUUID().toString();
+ entity.setJobID(jobID);
+ entity.setTransportType(job.getTransportType().name());
+ entity.setCreateUid(job.getCreateUid());
+ entity.setUpdateUid(job.getUpdateUid());
+ entity.setFromRegion(job.getFromRegion());
+ entity.setRunningRegion(job.getRunningRegion());
+ CreateOrUpdateDataSourceReq source = new CreateOrUpdateDataSourceReq();
+ source.setType(job.getTransportType().getSrc());
+ source.setOperator(job.getCreateUid());
+ source.setRegion(job.getSourceDataSource().getRegion());
+ source.setDesc(job.getSourceConnectorDesc());
+ Config sourceConfig = job.getSourceDataSource().getConf();
+ source.setConfig(sourceConfig);
+ source.setConfigClass(job.getSourceDataSource().getConfClazz().getName());
+ EventMeshDataSource createdSource = dataSourceBizService.createDataSource(source);
+ entity.setSourceData(createdSource.getId());
+
+ CreateOrUpdateDataSourceReq sink = new CreateOrUpdateDataSourceReq();
+ sink.setType(job.getTransportType().getDst());
+ sink.setOperator(job.getCreateUid());
+ sink.setRegion(job.getSinkDataSource().getRegion());
+ sink.setDesc(job.getSinkConnectorDesc());
+ Config sinkConfig = job.getSinkDataSource().getConf();
+ sink.setConfig(sinkConfig);
+ sink.setConfigClass(job.getSinkDataSource().getConfClazz().getName());
+ EventMeshDataSource createdSink = dataSourceBizService.createDataSource(sink);
+ entity.setTargetData(createdSink.getId());
+
+ entityList.add(entity);
+ }
+ int changed = jobInfoExtService.batchSave(entityList);
+ if (changed != entityList.size()) {
+ throw new AdminServerRuntimeException(ErrorCode.INTERNAL_ERR, String.format("create [%d] jobs of not match expect [%d]",
+ changed, jobs.size()));
+ }
+ return entityList;
+ }
+
+
+ public JobDetail getJobDetail(String jobID) {
+ if (jobID == null) {
+ return null;
+ }
+ EventMeshJobInfo job = jobInfoService.getOne(Wrappers.query().eq("jobID", jobID));
+ if (job == null) {
+ return null;
+ }
+ JobDetail detail = new JobDetail();
+ detail.setTaskID(job.getTaskID());
+ detail.setJobID(job.getJobID());
+ EventMeshDataSource source = dataSourceService.getById(job.getSourceData());
+ EventMeshDataSource target = dataSourceService.getById(job.getTargetData());
+ if (source != null) {
+ if (!StringUtils.isBlank(source.getConfiguration())) {
+ try {
+ DataSource sourceDataSource = new DataSource();
+ Class> configClass = Class.forName(source.getConfigurationClass());
+ sourceDataSource.setConf((Config) JsonUtils.parseObject(source.getConfiguration(), configClass));
+ detail.setSourceDataSource(sourceDataSource);
+ } catch (Exception e) {
+ log.warn("parse source config id [{}] fail", job.getSourceData(), e);
+ throw new AdminServerRuntimeException(ErrorCode.BAD_DB_DATA, "illegal source data source config");
+ }
+ }
+ detail.setSourceConnectorDesc(source.getDescription());
+ if (source.getDataType() != null) {
+ detail.setPositions(positionBizService.getPositionByJobID(job.getJobID(),
+ DataSourceType.getDataSourceType(source.getDataType())));
+
+ }
+ }
+ if (target != null) {
+ if (!StringUtils.isBlank(target.getConfiguration())) {
+ try {
+ DataSource sinkDataSource = new DataSource();
+ Class> configClass = Class.forName(target.getConfigurationClass());
+ sinkDataSource.setConf((Config) JsonUtils.parseObject(target.getConfiguration(), configClass));
+ detail.setSinkDataSource(sinkDataSource);
+ } catch (Exception e) {
+ log.warn("parse sink config id [{}] fail", job.getSourceData(), e);
+ throw new AdminServerRuntimeException(ErrorCode.BAD_DB_DATA, "illegal target data sink config");
+ }
+ }
+ detail.setSinkConnectorDesc(target.getDescription());
+ }
+
+ TaskState state = TaskState.fromIndex(job.getJobState());
+ if (state == null) {
+ throw new AdminServerRuntimeException(ErrorCode.BAD_DB_DATA, "illegal job state in db");
+ }
+ detail.setState(state);
+ detail.setTransportType(TransportType.getTransportType(job.getTransportType()));
+ detail.setJobType(JobType.fromIndex(job.getJobType()));
+ detail.setJobDesc(job.getJobDesc());
+ return detail;
+ }
+
+ public EventMeshJobInfo getJobInfo(String jobID) {
+ if (jobID == null) {
+ return null;
+ }
+ return jobInfoService.getOne(Wrappers.query().eq("jobID", jobID));
+ }
+
+ public List getJobsByTaskID(String taskID) {
+ if (taskID == null) {
+ return null;
+ }
+ return jobInfoService.list(Wrappers.query().eq("taskID", taskID));
+ }
+
+ public void checkJobInfo() {
+ List eventMeshJobInfoList = jobInfoService.list(Wrappers.query().eq("jobState", JobState.RUNNING.name()));
+ log.info("start check job info.to check job size:{}", eventMeshJobInfoList.size());
+ for (EventMeshJobInfo jobInfo : eventMeshJobInfoList) {
+ String jobID = jobInfo.getJobID();
+ if (StringUtils.isEmpty(jobID)) {
+ continue;
+ }
+ List heartbeatList = heartbeatService.list((Wrappers.query().eq("jobID", jobID)));
+ if (heartbeatList == null || heartbeatList.size() == 0) {
+ continue;
+ }
+ // if last heart beat update time have delay three period.print job heart beat delay warn
+ long currentTimeStamp = System.currentTimeMillis();
+ if (currentTimeStamp - heartbeatList.get(0).getUpdateTime().getTime() > 3 * heatBeatPeriod) {
+ log.warn("current job heart heart has delay.jobID:{},currentTimeStamp:{},last update time:{}", jobID, currentTimeStamp,
+ heartbeatList.get(0).getUpdateTime());
+ }
+ }
+ }
+
+ public TaskDetail getTaskDetail(String taskID, DataSourceType dataSourceType) {
+ TaskDetail taskDetail = new TaskDetail();
+ List jobInfoList = getJobsByTaskID(taskID);
+ if (jobInfoList == null || jobInfoList.size() == 0) {
+ return taskDetail;
+ }
+ for (EventMeshJobInfo jobInfo : jobInfoList) {
+ TransportType currentTransportType = TransportType.getTransportType(jobInfo.getTransportType());
+ JobType jobType = JobType.fromIndex(jobInfo.getJobType());
+ if (currentTransportType.getSrc().equals(dataSourceType)) {
+ if (jobType.name().equalsIgnoreCase(JobType.FULL.name())) {
+ taskDetail.setFullTask(jobInfo);
+ }
+ if (jobType.name().equalsIgnoreCase(JobType.INCREASE.name())) {
+ taskDetail.setIncreaseTask(jobInfo);
+ }
+ }
+ }
+ return taskDetail;
+ }
+
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/monitor/MonitorBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/monitor/MonitorBizService.java
new file mode 100644
index 0000000000..3377334144
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/monitor/MonitorBizService.java
@@ -0,0 +1,111 @@
+/*
+ * 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.monitor;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshMonitor;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshMonitorService;
+import org.apache.eventmesh.common.remote.request.QueryTaskMonitorRequest;
+import org.apache.eventmesh.common.remote.request.ReportMonitorRequest;
+import org.apache.eventmesh.common.remote.response.QueryTaskMonitorResponse;
+import org.apache.eventmesh.common.remote.task.TaskMonitor;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Service
+@Slf4j
+public class MonitorBizService {
+
+ @Autowired
+ private EventMeshMonitorService monitorService;
+
+ public boolean reportMonitorRecord(ReportMonitorRequest request) {
+ EventMeshMonitor monitor = new EventMeshMonitor();
+ monitor.setTaskID(request.getTaskID());
+ monitor.setJobID(request.getJobID());
+ monitor.setAddress(request.getAddress());
+ monitor.setTransportType(request.getTransportType());
+ monitor.setConnectorStage(request.getConnectorStage());
+ monitor.setTotalReqNum(request.getTotalReqNum());
+ monitor.setTotalTimeCost(request.getTotalTimeCost());
+ monitor.setMaxTimeCost(request.getMaxTimeCost());
+ monitor.setAvgTimeCost(request.getAvgTimeCost());
+ monitor.setTps(request.getTps());
+ return monitorService.save(monitor);
+ }
+
+ public QueryTaskMonitorResponse queryTaskMonitors(QueryTaskMonitorRequest request) {
+ if (StringUtils.isBlank(request.getTaskID())) {
+ throw new RuntimeException("task id is empty");
+ }
+ long limit = request.getLimit();
+ if (limit <= 0) {
+ log.info("query task monitor limit:{},use default value:{}", limit, 10);
+ limit = 10;
+ }
+
+ Page queryPage = new Page<>();
+ queryPage.setCurrent(1);
+ queryPage.setSize(limit);
+ queryPage.addOrder(OrderItem.desc("createTime"));
+
+ QueryWrapper queryWrapper = new QueryWrapper();
+ queryWrapper.eq("taskID", request.getTaskID());
+ if (StringUtils.isNotEmpty(request.getJobID())) {
+ queryWrapper.eq("jobID", request.getJobID());
+ }
+ List eventMeshMonitors = monitorService.list(queryPage, queryWrapper);
+ List taskMonitorList = new ArrayList<>();
+ if (eventMeshMonitors != null) {
+ log.info("query event mesh monitor size:{}", eventMeshMonitors.size());
+ if (log.isDebugEnabled()) {
+ log.debug("query event mesh monitor content:{}", JsonUtils.toJSONString(eventMeshMonitors));
+ }
+ for (EventMeshMonitor eventMeshMonitor : eventMeshMonitors) {
+ TaskMonitor monitor = new TaskMonitor();
+ monitor.setTaskID(eventMeshMonitor.getTaskID());
+ monitor.setJobID(eventMeshMonitor.getJobID());
+ monitor.setAddress(eventMeshMonitor.getAddress());
+ monitor.setTransportType(eventMeshMonitor.getTransportType());
+ monitor.setConnectorStage(eventMeshMonitor.getConnectorStage());
+ monitor.setTotalReqNum(eventMeshMonitor.getTotalReqNum());
+ monitor.setTotalTimeCost(eventMeshMonitor.getTotalTimeCost());
+ monitor.setMaxTimeCost(eventMeshMonitor.getMaxTimeCost());
+ monitor.setAvgTimeCost(eventMeshMonitor.getAvgTimeCost());
+ monitor.setTps(eventMeshMonitor.getTps());
+ monitor.setCreateTime(eventMeshMonitor.getCreateTime());
+ taskMonitorList.add(monitor);
+ }
+ }
+ QueryTaskMonitorResponse queryTaskMonitorResponse = new QueryTaskMonitorResponse();
+ queryTaskMonitorResponse.setTaskMonitors(taskMonitorList);
+ return queryTaskMonitorResponse;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IFetchPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IFetchPositionHandler.java
new file mode 100644
index 0000000000..2c039062f3
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IFetchPositionHandler.java
@@ -0,0 +1,32 @@
+/*
+ * 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.position;
+
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+import org.apache.eventmesh.common.remote.request.FetchPositionRequest;
+
+import java.util.List;
+
+/**
+ * IFetchPositionHandler
+ */
+public interface IFetchPositionHandler {
+
+ List handler(FetchPositionRequest request, Metadata metadata);
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IRecordPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IRecordPositionHandler.java
new file mode 100644
index 0000000000..fa38e14320
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IRecordPositionHandler.java
@@ -0,0 +1,30 @@
+/*
+ * 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.position;
+
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.request.RecordPositionRequest;
+
+/**
+ * IRecordPositionHandler
+ */
+public interface IRecordPositionHandler {
+
+ boolean handler(RecordPositionRequest request, Metadata metadata);
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IReportPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IReportPositionHandler.java
new file mode 100644
index 0000000000..75f392e395
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/IReportPositionHandler.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.service.position;
+
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.request.ReportPositionRequest;
+
+/**
+ * IReportPositionHandler
+ */
+public interface IReportPositionHandler {
+
+ boolean handler(ReportPositionRequest request, Metadata metadata);
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionBizService.java
new file mode 100644
index 0000000000..0c4cd7a423
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionBizService.java
@@ -0,0 +1,90 @@
+/*
+ * 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.position;
+
+import org.apache.eventmesh.admin.server.AdminServerRuntimeException;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+import org.apache.eventmesh.common.remote.request.FetchPositionRequest;
+import org.apache.eventmesh.common.remote.request.RecordPositionRequest;
+import org.apache.eventmesh.common.remote.request.ReportPositionRequest;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Service
+@Slf4j
+public class PositionBizService {
+
+ @Autowired
+ PositionHandlerFactory factory;
+
+ // called isValidateReportRequest before call this
+ public List getPosition(FetchPositionRequest request, Metadata metadata) {
+ if (request == null) {
+ return null;
+ }
+ isValidatePositionRequest(request.getDataSourceType());
+ IFetchPositionHandler handler = factory.getHandler(request.getDataSourceType());
+ return handler.handler(request, metadata);
+ }
+
+ public void isValidatePositionRequest(DataSourceType type) {
+ if (type == null) {
+ throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST, "data source type is null");
+ }
+ IReportPositionHandler handler = factory.getHandler(type);
+ if (handler == null) {
+ throw new AdminServerRuntimeException(ErrorCode.BAD_REQUEST,
+ String.format("illegal data base type [%s], it not match any report position handler", type));
+ }
+ }
+
+ // called isValidateReportRequest before call this
+ public boolean reportPosition(ReportPositionRequest request, Metadata metadata) {
+ if (request == null) {
+ return false;
+ }
+ isValidatePositionRequest(request.getDataSourceType());
+ IReportPositionHandler handler = factory.getHandler(request.getDataSourceType());
+ return handler.handler(request, metadata);
+ }
+
+ public List getPositionByJobID(String jobID, DataSourceType type) {
+ if (jobID == null || type == null) {
+ return null;
+ }
+ isValidatePositionRequest(type);
+ PositionHandler handler = factory.getHandler(type);
+ FetchPositionRequest request = new FetchPositionRequest();
+ request.setJobID(jobID);
+ return handler.handler(request, null);
+ }
+
+ public boolean recordPosition(RecordPositionRequest request, Metadata metadata) {
+ isValidatePositionRequest(request.getDataSourceType());
+ IRecordPositionHandler handler = factory.getHandler(request.getDataSourceType());
+ return handler.handler(request, metadata);
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandler.java
new file mode 100644
index 0000000000..9cbaf3fad6
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandler.java
@@ -0,0 +1,25 @@
+/*
+ * 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.position;
+
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+
+public abstract class PositionHandler implements IReportPositionHandler, IFetchPositionHandler, IRecordPositionHandler {
+
+ protected abstract DataSourceType getSourceType();
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandlerFactory.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandlerFactory.java
new file mode 100644
index 0000000000..c2065f80f4
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionHandlerFactory.java
@@ -0,0 +1,56 @@
+/*
+ * 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.position;
+
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class PositionHandlerFactory implements ApplicationListener {
+
+ private final Map handlers =
+ new ConcurrentHashMap<>();
+
+ public PositionHandler getHandler(DataSourceType type) {
+ return handlers.get(type);
+ }
+
+ @Override
+ public void onApplicationEvent(ContextRefreshedEvent event) {
+ Map beans =
+ event.getApplicationContext().getBeansOfType(PositionHandler.class);
+
+ for (PositionHandler handler : beans.values()) {
+ DataSourceType type = handler.getSourceType();
+ if (handlers.containsKey(type)) {
+ log.warn("data source type [{}] handler already exists", type);
+ continue;
+ }
+ handlers.put(type, handler);
+ }
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/HttpPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/HttpPositionHandler.java
new file mode 100644
index 0000000000..a58fa31c07
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/HttpPositionHandler.java
@@ -0,0 +1,67 @@
+/*
+ * 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.position.impl;
+
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshPositionReporterHistoryService;
+import org.apache.eventmesh.admin.server.web.service.position.PositionHandler;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+import org.apache.eventmesh.common.remote.request.FetchPositionRequest;
+import org.apache.eventmesh.common.remote.request.RecordPositionRequest;
+import org.apache.eventmesh.common.remote.request.ReportPositionRequest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class HttpPositionHandler extends PositionHandler {
+
+ @Autowired
+ EventMeshPositionReporterHistoryService historyService;
+
+ @Override
+ protected DataSourceType getSourceType() {
+ return DataSourceType.HTTP;
+ }
+
+ @Override
+ public boolean handler(ReportPositionRequest request, Metadata metadata) {
+ log.info("receive http position report request:{}", request);
+ // mock wemq postion report store
+ return true;
+ }
+
+ @Override
+ public List handler(FetchPositionRequest request, Metadata metadata) {
+ // mock http position fetch request
+ List recordPositionList = new ArrayList<>();
+ return recordPositionList;
+ }
+
+ @Override
+ public boolean handler(RecordPositionRequest request, Metadata metadata) {
+ return true;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/MysqlPositionHandler.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/MysqlPositionHandler.java
new file mode 100644
index 0000000000..8545078d80
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/MysqlPositionHandler.java
@@ -0,0 +1,351 @@
+/*
+ * 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.position.impl;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshMysqlPosition;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshPositionReporterHistory;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshMysqlPositionService;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshPositionReporterHistoryService;
+import org.apache.eventmesh.admin.server.web.pojo.BinlogPosition;
+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.PositionHandler;
+import org.apache.eventmesh.admin.server.web.utils.JdbcUtils;
+import org.apache.eventmesh.common.config.connector.rdb.canal.CanalSourceConfig;
+import org.apache.eventmesh.common.config.connector.rdb.canal.CanalSourceFullConfig;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+import org.apache.eventmesh.common.remote.offset.canal.CanalRecordOffset;
+import org.apache.eventmesh.common.remote.offset.canal.CanalRecordPartition;
+import org.apache.eventmesh.common.remote.request.FetchPositionRequest;
+import org.apache.eventmesh.common.remote.request.RecordPositionRequest;
+import org.apache.eventmesh.common.remote.request.ReportPositionRequest;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.LockSupport;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Component;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Component
+@Slf4j
+public class MysqlPositionHandler extends PositionHandler {
+ private static final int RETRY_TIMES = 3;
+ private static final String SQL_SELECT_RDB_VERSION = "select version() as rdb_version";
+ private static final String SQL_SHOW_BINLOG_POSITION = "SHOW MASTER STATUS";
+ private static final String SQL_SELECT_SERVER_UUID_IN_MARIADB = "SELECT @@global.server_id as server_uuid";
+ private static final String SQL_SHOW_SERVER_UUID_IN_MYSQL = "SELECT @@server_uuid as server_uuid";
+ private static final String SQL_SELECT_GTID_IN_MARIADB = "SELECT @@global.gtid_binlog_pos as gtid";
+ private static final String SQL_SELECT_GTID_IN_MYSQL = "SELECT @@gtid_executed as gtid";
+
+ private final long retryPeriod = Duration.ofMillis(500).toNanos();
+
+ @Autowired
+ EventMeshMysqlPositionService positionService;
+
+ @Autowired
+ EventMeshPositionReporterHistoryService historyService;
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @Override
+ protected DataSourceType getSourceType() {
+ return DataSourceType.MYSQL;
+ }
+
+ private boolean isNotForward(EventMeshMysqlPosition now, EventMeshMysqlPosition old) {
+ if (StringUtils.isNotBlank(old.getJournalName()) && old.getJournalName().equals(now.getJournalName())
+ && old.getPosition() >= now.getPosition()) {
+ log.info("job [{}] report position [{}] by runtime [{}] less than db position [{}] journal name [{}] by [{}]", now.getJobID(),
+ now.getPosition(), now.getAddress(), now.getJournalName(), old.getPosition(), old.getAddress());
+ return true;
+ }
+ return false;
+ }
+
+ public boolean saveOrUpdateByJob(EventMeshMysqlPosition position) {
+ for (int i = 0; i < RETRY_TIMES; i++) {
+ EventMeshMysqlPosition old = positionService.getOne(Wrappers.query().eq("jobId", position.getJobID()));
+ if (old == null) {
+ try {
+ return positionService.save(position);
+ } catch (DuplicateKeyException e) {
+ log.warn("current insert position fail, it will retry in 500ms");
+ LockSupport.parkNanos(retryPeriod);
+ continue;
+ } catch (Exception e) {
+ log.warn("insert position fail catch unknown exception", e);
+ return false;
+ }
+ }
+
+ if (isNotForward(position, old)) {
+ return true;
+ }
+ try {
+ if (!positionService.update(position,
+ Wrappers.update().eq("updateTime", old.getUpdateTime()).eq("jobID", old.getJobID()))) {
+ log.warn("update position [{}] fail, maybe current update. it will retry in 500ms", position);
+ LockSupport.parkNanos(retryPeriod);
+ continue;
+ }
+ return true;
+ } finally {
+ if (old.getAddress() != null && !old.getAddress().equals(position.getAddress())) {
+ EventMeshPositionReporterHistory history = new EventMeshPositionReporterHistory();
+ history.setRecord(JsonUtils.toJSONString(position));
+ history.setJob(old.getJobID());
+ history.setAddress(old.getAddress());
+ log.info("job [{}] position reporter changed old [{}], now [{}]", position.getJobID(), old, position);
+ try {
+ historyService.save(history);
+ } catch (Exception e) {
+ log.warn("save job [{}] mysql position reporter changed history fail, now reporter [{}], old [{}]", position.getJobID(),
+ position.getAddress(), old.getAddress(), e);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean handler(ReportPositionRequest request, Metadata metadata) {
+ try {
+ List recordPositionList = request.getRecordPositionList();
+ RecordPosition recordPosition = recordPositionList.get(0);
+ if (recordPosition == null || recordPosition.getRecordPartition() == null || recordPosition.getRecordOffset() == null) {
+ log.warn("report mysql position, but record-partition/partition/offset is null");
+ return false;
+ }
+ if (!(recordPosition.getRecordPartition() instanceof CanalRecordPartition)) {
+ log.warn("report mysql position, but record partition class [{}] not match [{}]",
+ recordPosition.getRecordPartition().getRecordPartitionClass(), CanalRecordPartition.class);
+ return false;
+ }
+ if (!(recordPosition.getRecordOffset() instanceof CanalRecordOffset)) {
+ log.warn("report mysql position, but record offset class [{}] not match [{}]",
+ recordPosition.getRecordOffset().getRecordOffsetClass(), CanalRecordOffset.class);
+ return false;
+ }
+ EventMeshMysqlPosition position = new EventMeshMysqlPosition();
+ position.setJobID(request.getJobID());
+ position.setAddress(request.getAddress());
+ CanalRecordOffset offset = (CanalRecordOffset) recordPosition.getRecordOffset();
+ if (offset != null) {
+ position.setPosition(offset.getOffset());
+ position.setGtid(offset.getGtid());
+ position.setCurrentGtid(offset.getCurrentGtid());
+ }
+ CanalRecordPartition partition = (CanalRecordPartition) recordPosition.getRecordPartition();
+ if (partition != null) {
+ position.setServerUUID(partition.getServerUUID());
+ position.setTimestamp(partition.getTimeStamp());
+ position.setJournalName(partition.getJournalName());
+ }
+ if (!saveOrUpdateByJob(position)) {
+ log.warn("update job position fail [{}]", request);
+ return false;
+ }
+ return true;
+ } catch (Exception e) {
+ log.warn("save position job [{}] fail", request.getJobID(), e);
+ }
+
+ return false;
+ }
+
+ @Override
+ public List handler(FetchPositionRequest request, Metadata metadata) {
+ List positionList = positionService.list(Wrappers.query().eq("jobID", request.getJobID()));
+ List recordPositionList = new ArrayList<>();
+ for (EventMeshMysqlPosition position : positionList) {
+ CanalRecordPartition partition = new CanalRecordPartition();
+ partition.setTimeStamp(position.getTimestamp());
+ partition.setJournalName(position.getJournalName());
+ partition.setServerUUID(position.getServerUUID());
+ RecordPosition recordPosition = new RecordPosition();
+ recordPosition.setRecordPartition(partition);
+ CanalRecordOffset offset = new CanalRecordOffset();
+ offset.setOffset(position.getPosition());
+ offset.setGtid(position.getGtid());
+ offset.setCurrentGtid(position.getCurrentGtid());
+ recordPosition.setRecordOffset(offset);
+ recordPositionList.add(recordPosition);
+ }
+ return recordPositionList;
+ }
+
+ @Override
+ public boolean handler(RecordPositionRequest request, Metadata metadata) {
+ try {
+ String fullJobID = request.getFullJobID();
+ String increaseJobID = request.getIncreaseJobID();
+ log.info("start record full job position to increase job position,full jobID:{}, increase jobID:{}.", fullJobID, increaseJobID);
+ JobDetail fullJobDetail = jobInfoBizService.getJobDetail(fullJobID);
+ CanalSourceConfig canalSourceConfig = (CanalSourceConfig) fullJobDetail.getSourceDataSource().getConf();
+ CanalSourceFullConfig canalSourceFullConfig = JsonUtils.mapToObject(canalSourceConfig.getSourceConfig(), CanalSourceFullConfig.class);
+ try (DruidDataSource druidDataSource = JdbcUtils.createDruidDataSource(canalSourceFullConfig.getSourceConnectorConfig().getUrl(),
+ canalSourceFullConfig.getSourceConnectorConfig().getUserName(), canalSourceFullConfig.getSourceConnectorConfig().getPassWord())) {
+
+ DataSourceType dataSourceType = checkRDBDataSourceType(druidDataSource);
+
+ ReportPositionRequest reportPositionRequest = new ReportPositionRequest();
+ reportPositionRequest.setJobID(increaseJobID);
+ reportPositionRequest.setDataSourceType(DataSourceType.MYSQL);
+ reportPositionRequest.setAddress(request.getAddress());
+
+ RecordPosition recordPosition = new RecordPosition();
+ CanalRecordOffset recordOffset = new CanalRecordOffset();
+ BinlogPosition binlogPosition = queryBinlogPosition(druidDataSource);
+ String gtid = queryGTID(druidDataSource, dataSourceType);
+ recordOffset.setOffset(binlogPosition.getPosition());
+ recordOffset.setGtid(gtid);
+ recordPosition.setRecordOffset(recordOffset);
+
+ CanalRecordPartition recordPartition = new CanalRecordPartition();
+ String serverUUID = queryServerUUID(druidDataSource, dataSourceType);
+ recordPartition.setJournalName(binlogPosition.getFile());
+ recordPartition.setServerUUID(serverUUID);
+ recordPosition.setRecordPartition(recordPartition);
+
+ List recordPositions = new ArrayList<>();
+ recordPositions.add(recordPosition);
+
+ reportPositionRequest.setRecordPositionList(recordPositions);
+ log.info("start store increase task position,jobID:{},request:{}", increaseJobID, reportPositionRequest);
+ handler(reportPositionRequest, metadata);
+ }
+ return true;
+ } catch (Exception e) {
+ log.error("record full job position to increase job position failed.", e);
+ return false;
+ }
+ }
+
+ private DataSourceType checkRDBDataSourceType(DruidDataSource druidDataSource) {
+ try {
+ log.info("execute sql '{}' start.", SQL_SELECT_RDB_VERSION);
+ try (PreparedStatement preparedStatement = druidDataSource.getConnection().prepareStatement(SQL_SELECT_RDB_VERSION)) {
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ log.info("execute sql '{}' result:{}", SQL_SELECT_RDB_VERSION, resultSet);
+ String rdbVersion = resultSet.getString("rdb_version");
+ if (StringUtils.isNotBlank(rdbVersion)) {
+ if (rdbVersion.toLowerCase().contains(DataSourceType.MariaDB.getName().toLowerCase())) {
+ return DataSourceType.MariaDB;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ log.warn("select rdb version failed,data source:{}", druidDataSource, e);
+ throw new RuntimeException("select rdb version failed");
+ }
+ return DataSourceType.MYSQL;
+ }
+
+ private BinlogPosition queryBinlogPosition(DruidDataSource druidDataSource) {
+ BinlogPosition binlogPosition = new BinlogPosition();
+ try {
+ log.info("execute sql '{}' start.", SQL_SHOW_BINLOG_POSITION);
+ try (PreparedStatement preparedStatement = druidDataSource.getConnection().prepareStatement(SQL_SHOW_BINLOG_POSITION)) {
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ log.info("execute sql '{}' result:{}", SQL_SELECT_RDB_VERSION, resultSet);
+ String fileName = resultSet.getString("File");
+ Long position = resultSet.getLong("Position");
+ binlogPosition.setFile(fileName);
+ binlogPosition.setPosition(position);
+ }
+ }
+ } catch (Exception e) {
+ log.warn("show binlog position failed,data source:{}", druidDataSource, e);
+ throw new RuntimeException("show binlog position failed");
+ }
+ return binlogPosition;
+ }
+
+ private String queryServerUUID(DruidDataSource druidDataSource, DataSourceType dataSourceType) {
+ String serverUUID = "";
+ try {
+ String queryServerUUIDSql;
+ if (DataSourceType.MariaDB.equals(dataSourceType)) {
+ queryServerUUIDSql = SQL_SELECT_SERVER_UUID_IN_MARIADB;
+ } else {
+ queryServerUUIDSql = SQL_SHOW_SERVER_UUID_IN_MYSQL;
+ }
+ log.info("execute sql '{}' start.", queryServerUUIDSql);
+ try (PreparedStatement preparedStatement = druidDataSource.getConnection().prepareStatement(queryServerUUIDSql)) {
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ log.info("execute sql '{}' result:{}", queryServerUUIDSql, resultSet);
+ serverUUID = resultSet.getString("server_uuid");
+ log.info("execute sql '{}',query server_uuid result:{}", queryServerUUIDSql, serverUUID);
+ return serverUUID;
+ }
+ }
+ } catch (Exception e) {
+ log.warn("select server_uuid failed,data source:{}", druidDataSource, e);
+ throw new RuntimeException("select server_uuid failed");
+ }
+ return serverUUID;
+ }
+
+ private String queryGTID(DruidDataSource druidDataSource, DataSourceType dataSourceType) {
+ String gitd = "";
+ try {
+ String queryGTIDSql;
+ if (DataSourceType.MariaDB.equals(dataSourceType)) {
+ queryGTIDSql = SQL_SELECT_GTID_IN_MARIADB;
+ } else {
+ queryGTIDSql = SQL_SELECT_GTID_IN_MYSQL;
+ }
+ log.info("execute sql '{}' start.", queryGTIDSql);
+ try (PreparedStatement preparedStatement = druidDataSource.getConnection().prepareStatement(queryGTIDSql)) {
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ log.info("execute sql '{}' result:{}", queryGTIDSql, resultSet);
+ gitd = resultSet.getString("gtid");
+ log.info("execute sql '{}',select gitd result:{}", queryGTIDSql, gitd);
+ return gitd;
+ }
+ }
+ } catch (Exception e) {
+ log.warn("select gtid failed,data source:{}", druidDataSource, e);
+ // when db server not open gitd mode, ignore gtid query exception
+ //throw new RuntimeException("select gtid failed");
+ }
+ return gitd;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/task/TaskBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/task/TaskBizService.java
new file mode 100644
index 0000000000..d3c7087d47
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/task/TaskBizService.java
@@ -0,0 +1,360 @@
+/*
+ * 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.task;
+
+import org.apache.eventmesh.admin.server.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshJobInfo;
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+import org.apache.eventmesh.admin.server.web.pojo.JobDetail;
+import org.apache.eventmesh.admin.server.web.service.job.JobInfoBizService;
+import org.apache.eventmesh.common.config.connector.Config;
+import org.apache.eventmesh.common.exception.EventMeshException;
+import org.apache.eventmesh.common.remote.JobState;
+import org.apache.eventmesh.common.remote.TaskState;
+import org.apache.eventmesh.common.remote.datasource.DataSource;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
+import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
+import org.apache.eventmesh.common.remote.request.TaskBachRequest;
+import org.apache.eventmesh.common.remote.request.TaskIDRequest;
+import org.apache.eventmesh.common.remote.response.CreateTaskResponse;
+import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Service
+public class TaskBizService {
+
+ @Autowired
+ private EventMeshTaskInfoService taskInfoService;
+
+ @Autowired
+ private JobInfoBizService jobInfoService;
+
+ @Autowired
+ private AdminServerProperties properties;
+
+ private static final String TYPE = "type";
+
+ private static final String DESC = "desc";
+
+ private static final String CONF_CLAZZ = "confClazz";
+
+ private static final String CONF = "conf";
+
+ private static final String REGION = "region";
+
+ @Transactional
+ public CreateTaskResponse createTask(CreateTaskRequest req) {
+ String taskID = req.getTaskId();
+ if (StringUtils.isEmpty(taskID)) {
+ taskID = UUID.randomUUID().toString();
+ req.setTaskId(taskID);
+ }
+
+ String targetRegion = req.getTargetRegion();
+ String remoteResponse = "";
+ // not from other admin && target not equals with self region
+ if (!req.isFlag() && !properties.getRegion().equals(targetRegion)) {
+ List adminServerList = Arrays.asList(properties.getAdminServerList().get(targetRegion).split(";"));
+ if (adminServerList == null || adminServerList.isEmpty()) {
+ throw new RuntimeException("No admin server available for region: " + targetRegion);
+ }
+ String targetUrl = adminServerList.get(new Random().nextInt(adminServerList.size())) + "/eventmesh/admin/createTask";
+
+ RestTemplate restTemplate = new RestTemplate();
+ req.setFlag(true);
+ ResponseEntity response = restTemplate.postForEntity(targetUrl, req, String.class);
+ if (!response.getStatusCode().is2xxSuccessful()) {
+ throw new RuntimeException("Failed to create task on admin server: " + targetUrl);
+ }
+ remoteResponse = response.getBody();
+ }
+
+ String finalTaskID = taskID;
+ List jobs = req.getJobs().stream().map(x -> {
+ JobDetail job = null;
+ try {
+ job = parse(x);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ job.setTaskID(finalTaskID);
+ job.setCreateUid(req.getUid());
+ job.setUpdateUid(req.getUid());
+ return job;
+ }).collect(Collectors.toList());
+
+ EventMeshTaskInfo taskInfo = new EventMeshTaskInfo();
+ taskInfo.setTaskID(finalTaskID);
+ taskInfo.setTaskName(req.getTaskName());
+ taskInfo.setTaskDesc(req.getTaskDesc());
+ taskInfo.setTaskState(TaskState.INIT.name());
+ taskInfo.setCreateUid(req.getUid());
+ taskInfo.setSourceRegion(req.getSourceRegion());
+ taskInfo.setTargetRegion(req.getTargetRegion());
+ List eventMeshJobInfoList = jobInfoService.createJobs(jobs);
+ taskInfoService.save(taskInfo);
+ return buildCreateTaskResponse(finalTaskID, eventMeshJobInfoList, remoteResponse);
+ }
+
+ private JobDetail parse(CreateTaskRequest.JobDetail src) throws ClassNotFoundException {
+ JobDetail dst = new JobDetail();
+ dst.setJobDesc(src.getJobDesc());
+ dst.setTransportType(src.getTransportType());
+ dst.setSourceConnectorDesc(src.getSourceConnectorDesc());
+ try {
+ dst.setSourceDataSource(mapToDataSource(src.getSourceDataSource()));
+ dst.setSinkDataSource(mapToDataSource(src.getSinkDataSource()));
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Failed to map data source", e);
+ }
+ dst.setSinkConnectorDesc(src.getSinkConnectorDesc());
+ // full/increase/check
+ dst.setJobType(src.getJobType());
+ dst.setFromRegion(src.getFromRegion());
+ dst.setRunningRegion(src.getRunningRegion());
+ return dst;
+ }
+
+ private DataSource mapToDataSource(Map dataMap) throws ClassNotFoundException {
+ DataSource dataSource = new DataSource();
+ dataSource.setType(DataSourceType.fromString(dataMap.get(TYPE).toString()));
+ dataSource.setDesc((String) dataMap.get(DESC));
+ dataSource.setConfClazz((Class extends Config>) Class.forName(dataMap.get(CONF_CLAZZ).toString()));
+ dataSource.setConf(JsonUtils.parseObject(JsonUtils.toJSONString(dataMap.get(CONF)), dataSource.getConfClazz()));
+ dataSource.setRegion((String) dataMap.get(REGION));
+ return dataSource;
+ }
+
+ private CreateTaskResponse buildCreateTaskResponse(String taskId, List eventMeshJobInfoList, String remoteResponse) {
+ CreateTaskResponse createTaskResponse = new CreateTaskResponse();
+ createTaskResponse.setTaskId(taskId);
+ List jobDetailList = new ArrayList<>();
+ if (!eventMeshJobInfoList.isEmpty()) {
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfoList) {
+ CreateTaskRequest.JobDetail jobDetail = new CreateTaskRequest.JobDetail();
+ jobDetail.setJobId(eventMeshJobInfo.getJobID());
+ jobDetail.setRunningRegion(eventMeshJobInfo.getRunningRegion());
+ jobDetailList.add(jobDetail);
+ }
+ }
+ if (!StringUtils.isEmpty(remoteResponse)) {
+ SimpleResponse response = JsonUtils.parseObject(remoteResponse, SimpleResponse.class);
+ CreateTaskResponse remoteCreateTaskResponse = JsonUtils.convertValue(response.getData(), CreateTaskResponse.class);
+ jobDetailList.addAll(remoteCreateTaskResponse.getJobIdList());
+ }
+ createTaskResponse.setJobIdList(jobDetailList);
+ return createTaskResponse;
+ }
+
+ /**
+ * start task
+ * @param taskIDRequest id
+ */
+ @Transactional
+ public void startTask(TaskIDRequest taskIDRequest) {
+ try {
+ EventMeshTaskInfo taskInfoServiceOne = taskInfoService.getOne(Wrappers.query()
+ .eq("taskID", taskIDRequest.getTaskID()));
+
+ if (Objects.isNull(taskInfoServiceOne)) {
+ throw new EventMeshException("task not found");
+ }
+
+ if (TaskState.DELETE.name().equals(taskInfoServiceOne.getTaskState())) {
+ throw new EventMeshException("task already deleted");
+ }
+
+ // update task state
+ taskInfoService.update(Wrappers.update()
+ .eq("id", taskInfoServiceOne.getId())
+ .set("taskState", TaskState.RUNNING.name()));
+
+ List eventMeshJobInfos = jobInfoService.getJobsByTaskID(taskIDRequest.getTaskID());
+
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfos) {
+ // update job state by jonID
+ jobInfoService.updateJobState(eventMeshJobInfo.getJobID(), JobState.RUNNING);
+ }
+
+ // todo: start task job eventmesh-runtime-v2 schedule ?
+
+ } catch (Exception e) {
+ log.info("start task exception:{}", e.getMessage());
+ throw new EventMeshException("start task exception");
+ }
+ }
+
+ @Transactional
+ public boolean deleteTaskByTaskID(TaskIDRequest taskIDRequest) {
+ try {
+ EventMeshTaskInfo taskInfoServiceOne = taskInfoService.getOne(Wrappers.query()
+ .eq("taskID", taskIDRequest.getTaskID()));
+
+ if (Objects.isNull(taskInfoServiceOne)) {
+ throw new EventMeshException("task not found");
+ }
+
+ if (!TaskState.DELETE.name().equals(taskInfoServiceOne.getTaskState())) {
+ // update task state to delete
+ taskInfoService.update(Wrappers.update()
+ .eq("id", taskInfoServiceOne.getId())
+ .set("taskState", TaskState.DELETE.name()));
+ }
+ List eventMeshJobInfos = jobInfoService.getJobsByTaskID(taskInfoServiceOne.getTaskID());
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfos) {
+ // update job state to delete
+ jobInfoService.updateJobState(eventMeshJobInfo.getJobID(), JobState.DELETE);
+ }
+ // todo: data source config need delete?
+
+ } catch (RuntimeException e) {
+ log.error("delete task failed:{}", e.getMessage());
+ throw new EventMeshException("delete task failed");
+ }
+ return true;
+ }
+
+ public List queryTaskInfo(QueryTaskInfoRequest taskInfoRequest) {
+ return taskInfoService.queryTaskInfo(taskInfoRequest);
+ }
+
+ @Transactional
+ public void restartTask(TaskIDRequest taskIDRequest) {
+ try {
+ EventMeshTaskInfo taskInfoServiceOne = taskInfoService.getOne(Wrappers.query()
+ .eq("taskID", taskIDRequest.getTaskID())
+ .ne("taskState", TaskState.DELETE.name()));
+
+ if (Objects.isNull(taskInfoServiceOne)) {
+ throw new EventMeshException("task not found");
+ }
+ if (!TaskState.RUNNING.name().equals(taskInfoServiceOne.getTaskState())) {
+ taskInfoService.update(Wrappers.update()
+ .eq("id", taskInfoServiceOne.getId())
+ .set("taskState", TaskState.RUNNING.name()));
+ }
+ List eventMeshJobInfos = jobInfoService.getJobsByTaskID(taskInfoServiceOne.getTaskID());
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfos) {
+ // update job state to restart
+ jobInfoService.updateJobState(eventMeshJobInfo.getJobID(), JobState.RUNNING);
+ }
+ // todo: start task job eventmesh-runtime-v2 schedule?
+
+ } catch (RuntimeException e) {
+ log.error("restart task filed:{}", e.getMessage());
+ throw new EventMeshException("restart task filed");
+ }
+ }
+
+ @Transactional
+ public void stopTask(TaskIDRequest taskIDRequest) {
+ try {
+ EventMeshTaskInfo taskInfoServiceOne = taskInfoService.getOne(Wrappers.query()
+ .eq("taskID", taskIDRequest.getTaskID()));
+
+ if (Objects.isNull(taskInfoServiceOne)) {
+ throw new EventMeshException("task not found");
+ }
+ if (!TaskState.PAUSE.name().equals(taskInfoServiceOne.getTaskState())) {
+ taskInfoService.update(Wrappers.update()
+ .eq("id", taskInfoServiceOne.getId())
+ .set("taskState", TaskState.PAUSE.name()));
+ }
+
+ List eventMeshJobInfos = jobInfoService.getJobsByTaskID(taskInfoServiceOne.getTaskID());
+ for (EventMeshJobInfo eventMeshJobInfo : eventMeshJobInfos) {
+ // update job state to pause
+ jobInfoService.updateJobState(eventMeshJobInfo.getJobID(), JobState.PAUSE);
+ }
+
+ // todo: stop task job eventmesh-runtime-v2 schedule?
+
+ } catch (RuntimeException e) {
+ log.error("stop task filed:{}", e.getMessage());
+ throw new EventMeshException("stop task filed");
+ }
+ }
+
+ @Transactional
+ public void restartBatchTask(List taskIDRequestList, List errorNames) {
+ for (TaskBachRequest task : taskIDRequestList) {
+ try {
+ TaskIDRequest taskIDRequest = new TaskIDRequest();
+ taskIDRequest.setTaskID(task.getTaskID());
+ startTask(taskIDRequest);
+ } catch (RuntimeException e) {
+ log.error("restart batch task failed:{}", e.getMessage());
+ errorNames.add(task.getTaskName());
+ }
+ }
+ }
+
+ @Transactional
+ public void stopBatchTask(List taskIDRequestList, List errorNames) {
+ for (TaskBachRequest task : taskIDRequestList) {
+ try {
+ TaskIDRequest taskIDRequest = new TaskIDRequest();
+ taskIDRequest.setTaskID(task.getTaskID());
+ stopTask(taskIDRequest);
+ } catch (RuntimeException e) {
+ log.error("stop batch task failed:{}", e.getMessage());
+ errorNames.add(task.getTaskName());
+ }
+ }
+ }
+
+ @Transactional
+ public void startBatchTask(List taskIDRequestList, List errorNames) {
+ for (TaskBachRequest task : taskIDRequestList) {
+ try {
+ TaskIDRequest taskIDRequest = new TaskIDRequest();
+ taskIDRequest.setTaskID(task.getTaskID());
+ restartTask(taskIDRequest);
+ } catch (RuntimeException e) {
+ log.error("start batch task failed:{}", e.getMessage());
+ errorNames.add(task.getTaskName());
+ }
+ }
+ }
+
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/verify/VerifyBizService.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/verify/VerifyBizService.java
new file mode 100644
index 0000000000..e4f08b30cc
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/verify/VerifyBizService.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.service.verify;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshVerify;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshVerifyService;
+import org.apache.eventmesh.common.remote.request.ReportVerifyRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class VerifyBizService {
+
+ @Autowired
+ private EventMeshVerifyService verifyService;
+
+ public boolean reportVerifyRecord(ReportVerifyRequest request) {
+ EventMeshVerify verify = new EventMeshVerify();
+ verify.setRecordID(request.getRecordID());
+ verify.setRecordSig(request.getRecordSig());
+ verify.setPosition(request.getPosition());
+ verify.setTaskID(request.getTaskID());
+ verify.setJobID(request.getJobID());
+ verify.setConnectorName(request.getConnectorName());
+ verify.setConnectorStage(request.getConnectorStage());
+ return verifyService.save(verify);
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64.java
new file mode 100644
index 0000000000..f85807b7f9
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64.java
@@ -0,0 +1,125 @@
+/*
+ * 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.utils;
+
+public class Base64 {
+ private static char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".toCharArray();
+ private static byte[] codes = new byte[256];
+
+ public Base64() {
+ }
+
+ public static char[] encode(byte[] data) {
+ char[] out = new char[(data.length + 2) / 3 * 4];
+ int i = 0;
+
+ for (int index = 0; i < data.length; index += 4) {
+ boolean quad = false;
+ boolean trip = false;
+ int val = 255 & data[i];
+ val <<= 8;
+ if (i + 1 < data.length) {
+ val |= 255 & data[i + 1];
+ trip = true;
+ }
+
+ val <<= 8;
+ if (i + 2 < data.length) {
+ val |= 255 & data[i + 2];
+ quad = true;
+ }
+
+ out[index + 3] = alphabet[quad ? val & 63 : 64];
+ val >>= 6;
+ out[index + 2] = alphabet[trip ? val & 63 : 64];
+ val >>= 6;
+ out[index + 1] = alphabet[val & 63];
+ val >>= 6;
+ out[index + 0] = alphabet[val & 63];
+ i += 3;
+ }
+
+ return out;
+ }
+
+ public static byte[] decode(char[] data) {
+ int tempLen = data.length;
+
+ int len;
+ for (len = 0; len < data.length; ++len) {
+ if (data[len] > 255 || codes[data[len]] < 0) {
+ --tempLen;
+ }
+ }
+
+ len = tempLen / 4 * 3;
+ if (tempLen % 4 == 3) {
+ len += 2;
+ }
+
+ if (tempLen % 4 == 2) {
+ ++len;
+ }
+
+ byte[] out = new byte[len];
+ int shift = 0;
+ int accum = 0;
+ int index = 0;
+
+ for (int ix = 0; ix < data.length; ++ix) {
+ int value = data[ix] > 255 ? -1 : codes[data[ix]];
+ if (value >= 0) {
+ accum <<= 6;
+ shift += 6;
+ accum |= value;
+ if (shift >= 8) {
+ shift -= 8;
+ out[index++] = (byte) (accum >> shift & 255);
+ }
+ }
+ }
+
+ if (index != out.length) {
+ throw new Error("Miscalculated data length (wrote " + index + " instead of " + out.length + ")");
+ } else {
+ return out;
+ }
+ }
+
+ static {
+ int i;
+ for (i = 0; i < 256; ++i) {
+ codes[i] = -1;
+ }
+
+ for (i = 65; i <= 90; ++i) {
+ codes[i] = (byte) (i - 65);
+ }
+
+ for (i = 97; i <= 122; ++i) {
+ codes[i] = (byte) (26 + i - 97);
+ }
+
+ for (i = 48; i <= 57; ++i) {
+ codes[i] = (byte) (52 + i - 48);
+ }
+
+ codes[43] = 62;
+ codes[47] = 63;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64Utils.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64Utils.java
new file mode 100644
index 0000000000..9c9a258671
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/Base64Utils.java
@@ -0,0 +1,94 @@
+/*
+ * 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.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class Base64Utils {
+ private static final int CACHE_SIZE = 1024;
+
+ public Base64Utils() {
+ }
+
+ public static byte[] decode(String base64) throws Exception {
+ return Base64.decode(base64.toCharArray());
+ }
+
+ public static String encode(byte[] bytes) throws Exception {
+ return new String(Base64.encode(bytes));
+ }
+
+ public static String encodeFile(String filePath) throws Exception {
+ byte[] bytes = fileToByte(filePath);
+ return encode(bytes);
+ }
+
+ public static void decodeToFile(String filePath, String base64) throws Exception {
+ byte[] bytes = decode(base64);
+ byteArrayToFile(bytes, filePath);
+ }
+
+ public static byte[] fileToByte(String filePath) throws Exception {
+ byte[] data = new byte[0];
+ File file = new File(filePath);
+ if (file.exists()) {
+ FileInputStream in = new FileInputStream(file);
+ ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
+ byte[] cache = new byte[1024];
+ int nread;
+
+ while ((nread = in.read(cache)) != -1) {
+ out.write(cache, 0, nread);
+ out.flush();
+ }
+
+ out.close();
+ in.close();
+ data = out.toByteArray();
+ }
+
+ return data;
+ }
+
+ public static void byteArrayToFile(byte[] bytes, String filePath) throws Exception {
+ InputStream in = new ByteArrayInputStream(bytes);
+ File destFile = new File(filePath);
+ if (!destFile.getParentFile().exists()) {
+ destFile.getParentFile().mkdirs();
+ }
+
+ destFile.createNewFile();
+ OutputStream out = new FileOutputStream(destFile);
+ byte[] cache = new byte[1024];
+
+ int nread;
+ while ((nread = ((InputStream) in).read(cache)) != -1) {
+ ((OutputStream) out).write(cache, 0, nread);
+ ((OutputStream) out).flush();
+ }
+
+ ((OutputStream) out).close();
+ ((InputStream) in).close();
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/EncryptUtil.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/EncryptUtil.java
new file mode 100644
index 0000000000..06c8bbc330
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/EncryptUtil.java
@@ -0,0 +1,138 @@
+/*
+ * 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.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class EncryptUtil {
+ public EncryptUtil() {
+ }
+
+ private static byte[] hexStringToBytes(String hexString) {
+ if (hexString != null && !hexString.equals("")) {
+ hexString = hexString.toUpperCase();
+ int length = hexString.length() / 2;
+ char[] hexChars = hexString.toCharArray();
+ byte[] d = new byte[length];
+
+ for (int i = 0; i < length; ++i) {
+ int pos = i * 2;
+ d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+
+ return d;
+ } else {
+ return null;
+ }
+ }
+
+ public static String byteToHexString(byte[] b) {
+ String a = "";
+
+ for (int i = 0; i < b.length; ++i) {
+ String hex = Integer.toHexString(b[i] & 255);
+ if (hex.length() == 1) {
+ hex = '0' + hex;
+ }
+
+ a = a + hex;
+ }
+
+ return a;
+ }
+
+ private static byte charToByte(char c) {
+ return (byte) "0123456789ABCDEF".indexOf(c);
+ }
+
+ private static String readFileContent(String filePath) {
+ File file = new File(filePath);
+ BufferedReader reader = null;
+ StringBuffer key = new StringBuffer();
+
+ try {
+ IOException e;
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ e = null;
+
+ String tempString;
+ while ((tempString = reader.readLine()) != null) {
+ if (!tempString.startsWith("--")) {
+ key.append(tempString);
+ }
+ }
+
+ reader.close();
+ } catch (IOException ioException) {
+ e = ioException;
+ e.printStackTrace();
+ }
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+
+ }
+
+ return key.toString();
+ }
+
+ public static String decrypt(String sysPubKeyFile, String appPrivKeyFile, String encStr) throws Exception {
+ String pubKeyBase64 = readFileContent(sysPubKeyFile);
+ String privKeyBase64 = readFileContent(appPrivKeyFile);
+ byte[] encBin = hexStringToBytes(encStr);
+ byte[] pubDecBin = RSAUtils.decryptByPublicKeyBlock(encBin, pubKeyBase64);
+ byte[] privDecBin = RSAUtils.decryptByPrivateKeyBlock(pubDecBin, privKeyBase64);
+ return new String(privDecBin);
+ }
+
+ public static String decrypt(ParamType pubKeyType, String sysPubKey, ParamType privKeyType, String appPrivKey, ParamType passwdType,
+ String passwd) throws Exception {
+ String pubKeyBase64 = pubKeyType == ParamType.FILE ? readFileContent(sysPubKey) : sysPubKey;
+ String privKeyBase64 = privKeyType == ParamType.FILE ? readFileContent(appPrivKey) : appPrivKey;
+ String passwdContent = passwdType == ParamType.FILE ? readFileContent(passwd) : passwd;
+ byte[] encBin = hexStringToBytes(passwdContent);
+ byte[] pubDecBin = RSAUtils.decryptByPublicKeyBlock(encBin, pubKeyBase64);
+ byte[] privDecBin = RSAUtils.decryptByPrivateKeyBlock(pubDecBin, privKeyBase64);
+ return new String(privDecBin);
+ }
+
+ public static String encrypt(String appPubKeyFile, String sysPrivKeyFile, String passwd) throws Exception {
+ String pubKeyBase64 = readFileContent(appPubKeyFile);
+ String privKeyBase64 = readFileContent(sysPrivKeyFile);
+ byte[] pubEncBin = RSAUtils.encryptByPublicKeyBlock(passwd.getBytes(), pubKeyBase64);
+ byte[] privEncBin = RSAUtils.encryptByPrivateKeyBlock(pubEncBin, privKeyBase64);
+ return byteToHexString(privEncBin);
+ }
+
+ public static String encrypt(ParamType pubKeyType, String appPubKey, ParamType privKeyType, String sysPrivKey, String passwd) throws Exception {
+ String pubKeyBase64 = pubKeyType == ParamType.FILE ? readFileContent(appPubKey) : appPubKey;
+ String privKeyBase64 = privKeyType == ParamType.FILE ? readFileContent(sysPrivKey) : sysPrivKey;
+ byte[] pubEncBin = RSAUtils.encryptByPublicKeyBlock(passwd.getBytes(), pubKeyBase64);
+ byte[] privEncBin = RSAUtils.encryptByPrivateKeyBlock(pubEncBin, privKeyBase64);
+ return byteToHexString(privEncBin);
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/JdbcUtils.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/JdbcUtils.java
new file mode 100644
index 0000000000..c012806e2e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/JdbcUtils.java
@@ -0,0 +1,43 @@
+/*
+ * 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.utils;
+
+import com.alibaba.druid.pool.DruidDataSource;
+
+public class JdbcUtils {
+
+ public static DruidDataSource createDruidDataSource(String url, String userName, String passWord) {
+ DruidDataSource dataSource = new DruidDataSource();
+ dataSource.setUrl(url);
+ dataSource.setUsername(userName);
+ dataSource.setPassword(passWord);
+ dataSource.setInitialSize(5);
+ dataSource.setMinIdle(5);
+ dataSource.setMaxActive(20);
+ dataSource.setMaxWait(60000);
+ dataSource.setTimeBetweenEvictionRunsMillis(60000);
+ dataSource.setMinEvictableIdleTimeMillis(300000);
+ dataSource.setValidationQuery("SELECT 1");
+ dataSource.setTestWhileIdle(true);
+ dataSource.setTestOnBorrow(false);
+ dataSource.setTestOnReturn(false);
+ dataSource.setPoolPreparedStatements(true);
+ dataSource.setMaxPoolPreparedStatementPerConnectionSize(20);
+ return dataSource;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/ParamType.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/ParamType.java
new file mode 100644
index 0000000000..ed58a49b89
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/ParamType.java
@@ -0,0 +1,26 @@
+/*
+ * 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.utils;
+
+public enum ParamType {
+ FILE,
+ STRING;
+
+ private ParamType() {
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/RSAUtils.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/RSAUtils.java
new file mode 100644
index 0000000000..9353eb3f17
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/utils/RSAUtils.java
@@ -0,0 +1,255 @@
+/*
+ * 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.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.crypto.Cipher;
+
+public class RSAUtils {
+ public static final String KEY_ALGORITHM = "RSA";
+ public static final String SIGNATURE_ALGORITHM = "MD5withRSA";
+ private static final String PUBLIC_KEY = "RSAPublicKey";
+ private static final String PRIVATE_KEY = "RSAPrivateKey";
+ private static final int MAX_ENCRYPT_BLOCK = 117;
+ private static final int MAX_DECRYPT_BLOCK = 128;
+
+ public RSAUtils() {
+ }
+
+ public static Map genKeyPair() throws Exception {
+ KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
+ keyPairGen.initialize(1024);
+ KeyPair keyPair = keyPairGen.generateKeyPair();
+ RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
+ RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
+ Map keyMap = new HashMap(2);
+ keyMap.put("RSAPublicKey", publicKey);
+ keyMap.put("RSAPrivateKey", privateKey);
+ return keyMap;
+ }
+
+ public static String sign(byte[] data, String privateKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(privateKey);
+ PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ PrivateKey privateK = keyFactory.generatePrivate(pkcs8KeySpec);
+ Signature signature = Signature.getInstance("MD5withRSA");
+ signature.initSign(privateK);
+ signature.update(data);
+ return Base64Utils.encode(signature.sign());
+ }
+
+ public static boolean verify(byte[] data, String publicKey, String sign) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(publicKey);
+ X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ PublicKey publicK = keyFactory.generatePublic(keySpec);
+ Signature signature = Signature.getInstance("MD5withRSA");
+ signature.initVerify(publicK);
+ signature.update(data);
+ return signature.verify(Base64Utils.decode(sign));
+ }
+
+ public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(privateKey);
+ PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(2, privateK);
+ int inputLen = encryptedData.length;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int offSet = 0;
+
+ for (int i = 0; inputLen - offSet > 0; offSet = i * 128) {
+ byte[] cache;
+ if (inputLen - offSet > 128) {
+ cache = cipher.doFinal(encryptedData, offSet, 128);
+ } else {
+ cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
+ }
+
+ out.write(cache, 0, cache.length);
+ ++i;
+ }
+
+ byte[] decryptedData = out.toByteArray();
+ out.close();
+ return decryptedData;
+ }
+
+ public static byte[] decryptByPrivateKeyBlock(byte[] encryptedData, String privateKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(privateKey);
+ PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(2, privateK);
+ int inputLen = encryptedData.length;
+ int offSet = 0;
+ byte[] cache = cipher.doFinal(encryptedData, offSet, inputLen);
+ return cache;
+ }
+
+ public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(publicKey);
+ X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key publicK = keyFactory.generatePublic(x509KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(2, publicK);
+ int inputLen = encryptedData.length;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int offSet = 0;
+
+ for (int i = 0; inputLen - offSet > 0; offSet = i * 128) {
+ byte[] cache;
+ if (inputLen - offSet > 128) {
+ cache = cipher.doFinal(encryptedData, offSet, 128);
+ } else {
+ cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
+ }
+
+ out.write(cache, 0, cache.length);
+ ++i;
+ }
+
+ byte[] decryptedData = out.toByteArray();
+ out.close();
+ return decryptedData;
+ }
+
+ public static byte[] decryptByPublicKeyBlock(byte[] encryptedData, String publicKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(publicKey);
+ X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key publicK = keyFactory.generatePublic(x509KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(2, publicK);
+ int inputLen = encryptedData.length;
+ int offSet = 0;
+ byte[] cache = cipher.doFinal(encryptedData, offSet, inputLen);
+ return cache;
+ }
+
+ public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(publicKey);
+ X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key publicK = keyFactory.generatePublic(x509KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(1, publicK);
+ int inputLen = data.length;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int offSet = 0;
+
+ for (int i = 0; inputLen - offSet > 0; offSet = i * 117) {
+ byte[] cache;
+ if (inputLen - offSet > 117) {
+ cache = cipher.doFinal(data, offSet, 117);
+ } else {
+ cache = cipher.doFinal(data, offSet, inputLen - offSet);
+ }
+
+ out.write(cache, 0, cache.length);
+ ++i;
+ }
+
+ byte[] encryptedData = out.toByteArray();
+ out.close();
+ return encryptedData;
+ }
+
+ public static byte[] encryptByPublicKeyBlock(byte[] data, String publicKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(publicKey);
+ X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key publicK = keyFactory.generatePublic(x509KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(1, publicK);
+ int inputLen = data.length;
+ int offSet = 0;
+ byte[] cache = cipher.doFinal(data, offSet, inputLen);
+ return cache;
+ }
+
+ public static byte[] encryptByPrivateKey(byte[] data, String privateKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(privateKey);
+ PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(1, privateK);
+ int inputLen = data.length;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int offSet = 0;
+
+ for (int i = 0; inputLen - offSet > 0; offSet = i * 117) {
+ byte[] cache;
+ if (inputLen - offSet > 117) {
+ cache = cipher.doFinal(data, offSet, 117);
+ } else {
+ cache = cipher.doFinal(data, offSet, inputLen - offSet);
+ }
+
+ out.write(cache, 0, cache.length);
+ ++i;
+ }
+
+ byte[] encryptedData = out.toByteArray();
+ out.close();
+ return encryptedData;
+ }
+
+ public static byte[] encryptByPrivateKeyBlock(byte[] data, String privateKey) throws Exception {
+ byte[] keyBytes = Base64Utils.decode(privateKey);
+ PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
+ Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
+ cipher.init(1, privateK);
+ int inputLen = data.length;
+ int offSet = 0;
+ byte[] cache = cipher.doFinal(data, offSet, inputLen);
+ return cache;
+ }
+
+ public static String getPrivateKey(Map keyMap) throws Exception {
+ Key key = (Key) keyMap.get("RSAPrivateKey");
+ return Base64Utils.encode(key.getEncoded());
+ }
+
+ public static String getPublicKey(Map keyMap) throws Exception {
+ Key key = (Key) keyMap.get("RSAPublicKey");
+ return Base64Utils.encode(key.getEncoded());
+ }
+}
diff --git a/eventmesh-admin-server/src/main/resources/META-INF/spring.factories b/eventmesh-admin-server/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000000..0d9e9bae6e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+ org.apache.eventmesh.admin.server.AdminServerProperties
\ No newline at end of file
diff --git a/eventmesh-common/build.gradle b/eventmesh-common/build.gradle
index 07068fe4c1..21b6e63d44 100644
--- a/eventmesh-common/build.gradle
+++ b/eventmesh-common/build.gradle
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-def grpcVersion = '1.64.0'
+def grpcVersion = '1.68.0'
dependencies {
api "com.google.guava:guava"
@@ -48,6 +48,7 @@ dependencies {
implementation "org.apache.httpcomponents:httpclient"
implementation "io.netty:netty-all"
+ compileOnly 'com.mysql:mysql-connector-j'
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/AbstractComponent.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/AbstractComponent.java
new file mode 100644
index 0000000000..375b6cb1d3
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/AbstractComponent.java
@@ -0,0 +1,54 @@
+/*
+ * 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.common;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class AbstractComponent implements ComponentLifeCycle {
+ private final AtomicBoolean started = new AtomicBoolean(false);
+ private final AtomicBoolean stopped = new AtomicBoolean(false);
+
+ @Override
+ public void start() throws Exception {
+ if (!started.compareAndSet(false, true)) {
+ log.info("component [{}] has started", this.getClass());
+ return;
+ }
+ log.info("component [{}] will start", this.getClass());
+ run();
+ log.info("component [{}] started successfully", this.getClass());
+ }
+
+ @Override
+ public void stop() throws Exception {
+ if (!stopped.compareAndSet(false, true)) {
+ log.info("component [{}] has stopped", this.getClass());
+ return;
+ }
+ log.info("component [{}] will stop", this.getClass());
+ shutdown();
+ log.info("component [{}] stopped successfully", this.getClass());
+ }
+
+ protected abstract void run() throws Exception;
+
+ protected abstract void shutdown() throws Exception;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/ComponentLifeCycle.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ComponentLifeCycle.java
new file mode 100644
index 0000000000..76fdd548d0
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ComponentLifeCycle.java
@@ -0,0 +1,28 @@
+/*
+ * 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.common;
+
+/**
+ * LifeCycle of EventMesh Component
+ */
+public interface ComponentLifeCycle {
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/Constants.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/Constants.java
index 867d50b43b..2460129e75 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/Constants.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/Constants.java
@@ -200,9 +200,13 @@ public class Constants {
public static final String GRPC = "GRPC";
+ public static final String ADMIN = "ADMIN";
+
public static final String OS_NAME_KEY = "os.name";
public static final String OS_WIN_PREFIX = "win";
public static final String DEFAULT = "default";
+
+ public static final String ADMIN_SERVER_REGISTRY_NAME = "DEFAULT_GROUP@@em_adm_server";
}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
index 2f38a372ce..04c4ae60ed 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
@@ -106,6 +106,21 @@ public class CommonConfiguration {
@ConfigField(field = "server.retry.plugin.type")
private String eventMeshRetryPluginType = Constants.DEFAULT;
+ @ConfigField(field = "registry.plugin.server-addr", notEmpty = true)
+ private String registryAddr = "";
+
+ @ConfigField(field = "registry.plugin.type", notEmpty = true)
+ private String eventMeshRegistryPluginType = "nacos";
+
+ @ConfigField(field = "registry.plugin.username")
+ private String eventMeshRegistryPluginUsername = "";
+
+ @ConfigField(field = "registry.plugin.password")
+ private String eventMeshRegistryPluginPassword = "";
+
+ @ConfigField(field = "registry.plugin.enabled")
+ private boolean eventMeshRegistryPluginEnabled = false;
+
public void reload() {
this.eventMeshWebhookOrigin = "eventmesh." + eventMeshIDC;
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java
index 7c5b17d7e6..3f3f609a1f 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java
@@ -60,6 +60,9 @@ private ConfigService() {
}
public ConfigService setConfigPath(String configPath) {
+ if (StringUtils.isNotBlank(configPath) && !configPath.endsWith(File.separator)) {
+ configPath = configPath + File.separator;
+ }
this.configPath = configPath;
return this;
}
@@ -128,7 +131,7 @@ public T getConfig(ConfigInfo configInfo) throws IOException {
} else {
filePath = path.startsWith(FILE_PATH_PREFIX) ? path.substring(FILE_PATH_PREFIX.length()) : this.configPath + path;
}
-
+ filePath = normalizeFilePath(filePath);
if (filePath.contains(".jar")) {
try (final InputStream inputStream = getClass().getResourceAsStream(Objects.requireNonNull(resourceUrl))) {
if (inputStream == null) {
@@ -149,6 +152,15 @@ public T getConfig(ConfigInfo configInfo) throws IOException {
return (T) object;
}
+ private String normalizeFilePath(String filePath) {
+ if (System.getProperty("os.name").toLowerCase().contains("win")) {
+ if (filePath.startsWith("/")) {
+ filePath = filePath.substring(1);
+ }
+ }
+ return filePath;
+ }
+
private void populateConfig(Object object, Class> clazz, Config config)
throws NoSuchFieldException, IOException, IllegalAccessException {
ConfigInfo configInfo = new ConfigInfo();
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java
index a0c81ea481..4f8c6687b8 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java
@@ -68,6 +68,7 @@ class PropertiesFileLoad implements FileLoad {
private final Convert convert = new Convert();
@SuppressWarnings("unchecked")
+ @Override
public T getConfig(ConfigInfo configInfo) throws IOException {
final Properties properties = new Properties();
if (StringUtils.isNotBlank(configInfo.getResourceUrl())) {
diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Config.java
similarity index 93%
rename from eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Config.java
index 330aa93932..d4bdee7778 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Config.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Config.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.api.config;
+package org.apache.eventmesh.common.config.connector;
public abstract class Config {
}
diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Constants.java
similarity index 73%
rename from eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Constants.java
index 59794e562a..817efb6d3a 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/Constants.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/Constants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.api.config;
+package org.apache.eventmesh.common.config.connector;
public class Constants {
@@ -30,4 +30,21 @@ public class Constants {
public static final int DEFAULT_ATTEMPT = 3;
public static final int DEFAULT_PORT = 8080;
+
+ // ======================== Source Constants ========================
+ /**
+ * Default capacity
+ */
+ public static final int DEFAULT_CAPACITY = 1024;
+
+ /**
+ * Default poll batch size
+ */
+ public static final int DEFAULT_POLL_BATCH_SIZE = 10;
+
+ /**
+ * Default poll timeout (unit: ms)
+ */
+ public static final long DEFAULT_POLL_TIMEOUT = 5000L;
+
}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PollConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PollConfig.java
new file mode 100644
index 0000000000..cf3f06be91
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PollConfig.java
@@ -0,0 +1,43 @@
+/*
+ * 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.common.config.connector;
+
+import lombok.Data;
+
+/**
+ * Source Poll Config
+ */
+@Data
+public class PollConfig {
+
+ /**
+ * Capacity of the poll queue
+ */
+ private int capacity = Constants.DEFAULT_CAPACITY;
+
+ /**
+ * Max batch size of the poll
+ */
+ private int maxBatchSize = Constants.DEFAULT_POLL_BATCH_SIZE;
+
+ /**
+ * Max wait time of the poll
+ */
+ private long maxWaitTime = Constants.DEFAULT_POLL_TIMEOUT;
+
+}
diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PubSubConfig.java
similarity index 95%
rename from eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PubSubConfig.java
index 6f5c9cd5f4..be83d51127 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/PubSubConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/PubSubConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.api.config;
+package org.apache.eventmesh.common.config.connector;
import lombok.Data;
diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SinkConfig.java
similarity index 94%
rename from eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SinkConfig.java
index 527d02e04d..4ef68291d3 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SinkConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.api.config;
+package org.apache.eventmesh.common.config.connector;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SourceConfig.java
similarity index 80%
rename from eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SourceConfig.java
index 2942be936c..f7bc42970c 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-java/src/main/java/org/apache/eventmesh/openconnect/api/config/SourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/SourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.api.config;
+package org.apache.eventmesh.common.config.connector;
-import org.apache.eventmesh.openconnect.offsetmgmt.api.config.OffsetStorageConfig;
+import org.apache.eventmesh.common.config.connector.offset.OffsetStorageConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -30,4 +30,7 @@ public abstract class SourceConfig extends Config {
private OffsetStorageConfig offsetStorageConfig;
+ // Polling configuration, e.g. capacity, batch size, wait time, etc.
+ private PollConfig pollConfig = new PollConfig();
+
}
diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/DingDingSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/DingDingSinkConfig.java
index aa4245219f..3482d5665c 100644
--- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/DingDingSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/DingDingSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.dingtalk.sink.config;
+package org.apache.eventmesh.common.config.connector.dingtalk;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/SinkConnectorConfig.java
index 2211fd1adc..1dfcd76640 100644
--- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/dingtalk/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.dingtalk.sink.config;
+package org.apache.eventmesh.common.config.connector.dingtalk;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSinkConfig.java
index abdae52770..7de6daa51e 100644
--- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/FileSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.file.sink.config;
+package org.apache.eventmesh.common.config.connector.file;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSourceConfig.java
index b969544403..06bc4c1745 100644
--- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/FileSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/FileSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.file.source.config;
+package org.apache.eventmesh.common.config.connector.file;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SinkConnectorConfig.java
index a8cf958f7f..ee42a17759 100644
--- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.file.sink.config;
+package org.apache.eventmesh.common.config.connector.file;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SourceConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SourceConnectorConfig.java
index 6376a7fb4a..786d8fa743 100644
--- a/eventmesh-connectors/eventmesh-connector-file/src/main/java/org/apache/eventmesh/connector/file/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/file/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.file.source.config;
+package org.apache.eventmesh.common.config.connector.file;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpRetryConfig.java
similarity index 90%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpRetryConfig.java
index 0bceac7d47..319732a875 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpRetryConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpRetryConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.sink.config;
+package org.apache.eventmesh.common.config.connector.http;
import lombok.Data;
@@ -24,8 +24,8 @@ public class HttpRetryConfig {
// maximum number of retries, default 2, minimum 0
private int maxRetries = 2;
- // retry interval, default 2000ms
- private int interval = 2000;
+ // retry interval, default 1000ms
+ private int interval = 1000;
// Default value is false, indicating that only requests with network-level errors will be retried.
// If set to true, all failed requests will be retried, including network-level errors and non-2xx responses.
diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSinkConfig.java
index 3dd0c2b6a5..3c429f3355 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.sink.config;
+package org.apache.eventmesh.common.config.connector.http;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSourceConfig.java
index bee870cb1a..476dfb10de 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/HttpSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.source.config;
+package org.apache.eventmesh.common.config.connector.http;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpWebhookConfig.java
similarity index 95%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpWebhookConfig.java
index f15bac4568..96b9e09826 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/HttpWebhookConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/HttpWebhookConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.sink.config;
+package org.apache.eventmesh.common.config.connector.http;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SinkConnectorConfig.java
similarity index 81%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SinkConnectorConfig.java
index 9bb338cceb..65fc8fe72d 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SinkConnectorConfig.java
@@ -15,9 +15,8 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.sink.config;
+package org.apache.eventmesh.common.config.connector.http;
-import io.vertx.core.http.HttpClientOptions;
import lombok.Data;
@@ -29,19 +28,19 @@ public class SinkConnectorConfig {
private String[] urls;
// keepAlive, default true
- private boolean keepAlive = HttpClientOptions.DEFAULT_KEEP_ALIVE;
+ private boolean keepAlive = true;
// timeunit: ms, default 60000ms
- private int keepAliveTimeout = HttpClientOptions.DEFAULT_KEEP_ALIVE_TIMEOUT * 1000; // Keep units consistent
+ private int keepAliveTimeout = 60 * 1000; // Keep units consistent
// timeunit: ms, default 5000ms, recommended scope: 5000ms - 10000ms
private int connectionTimeout = 5000;
// timeunit: ms, default 5000ms
- private int idleTimeout;
+ private int idleTimeout = 5000;
- // maximum number of HTTP/1 connections a client will pool, default 5
- private int maxConnectionPoolSize = HttpClientOptions.DEFAULT_MAX_POOL_SIZE;
+ // maximum number of HTTP/1 connections a client will pool, default 50
+ private int maxConnectionPoolSize = 50;
// retry config
private HttpRetryConfig retryConfig = new HttpRetryConfig();
@@ -49,6 +48,15 @@ public class SinkConnectorConfig {
// webhook config
private HttpWebhookConfig webhookConfig = new HttpWebhookConfig();
+ private String deliveryStrategy = "ROUND_ROBIN";
+
+ private boolean skipDeliverException = false;
+
+ // managed pipelining param, default true
+ private boolean isParallelized = true;
+
+ private int parallelism = 2;
+
/**
* Fill default values if absent (When there are multiple default values for a field)
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SourceConnectorConfig.java
new file mode 100644
index 0000000000..2c091e321a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SourceConnectorConfig.java
@@ -0,0 +1,61 @@
+/*
+ * 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.common.config.connector.http;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.Data;
+
+@Data
+public class SourceConnectorConfig {
+
+ private String connectorName;
+
+ private String path = "/";
+
+ private int port;
+
+ // timeunit: ms, default 5000ms
+ private int idleTimeout = 5000;
+
+ /**
+ *
+ * The maximum size allowed for form attributes when Content-Type is application/x-www-form-urlencoded or multipart/form-data
+ * Default is 1MB (1024 * 1024 bytes).
+ * If you receive a "size exceed allowed maximum capacity" error, you can increase this value.
+ * Note: This applies only when handling form data submissions.
+ *
+ */
+ private int maxFormAttributeSize = 1024 * 1024;
+
+ // max size of the queue, default 1000
+ private int maxStorageSize = 1000;
+
+ // batch size, default 10
+ private int batchSize = 10;
+
+ // protocol, default CloudEvent
+ private String protocol = "Common";
+
+ // extra config, e.g. GitHub secret
+ private Map extraConfig = new HashMap<>();
+
+ // data consistency enabled, default true
+ private boolean dataConsistencyEnabled = true;
+}
diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSinkConfig.java
index 85bb38a90b..aff7c275a5 100644
--- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/KnativeSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.knative.sink.config;
+package org.apache.eventmesh.common.config.connector.knative;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSourceConfig.java
index 8ef36a8d78..644161d915 100644
--- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/KnativeSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/KnativeSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.knative.source.config;
+package org.apache.eventmesh.common.config.connector.knative;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SinkConnectorConfig.java
index 5694c643f8..076bd68756 100644
--- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.knative.sink.config;
+package org.apache.eventmesh.common.config.connector.knative;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SourceConnectorConfig.java
index 8d21c86b7b..98e7815520 100644
--- a/eventmesh-connectors/eventmesh-connector-knative/src/main/java/org/apache/eventmesh/connector/knative/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/knative/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.knative.source.config;
+package org.apache.eventmesh.common.config.connector.knative;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/LarkSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/LarkSinkConfig.java
index a97ece91b0..a9235129a0 100644
--- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/LarkSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/LarkSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.lark.sink.config;
+package org.apache.eventmesh.common.config.connector.lark;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/SinkConnectorConfig.java
similarity index 56%
rename from eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/SinkConnectorConfig.java
index cde3aa6737..a4895b8b2e 100644
--- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/lark/SinkConnectorConfig.java
@@ -15,13 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.lark.sink.config;
-
-import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord;
-
-import org.apache.commons.lang3.StringUtils;
-
-import com.lark.oapi.service.im.v1.enums.ReceiveIdTypeEnum;
+package org.apache.eventmesh.common.config.connector.lark;
import lombok.Data;
@@ -53,8 +47,6 @@ public class SinkConnectorConfig {
/**
* When sinking CouldEvent to lark, choose to call
- * {@link org.apache.eventmesh.connector.lark.sink.ImServiceHandler#sink(ConnectRecord)}
- * or {@link org.apache.eventmesh.connector.lark.sink.ImServiceHandler#sinkAsync(ConnectRecord)}
*/
private String sinkAsync = "true";
@@ -62,20 +54,4 @@ public class SinkConnectorConfig {
private String retryDelayInMills = "1000";
- public void validateSinkConfiguration() {
- // validate blank
- if (StringUtils.isAnyBlank(appId, appSecret, receiveId)) {
- throw new IllegalArgumentException("appId or appSecret or receiveId is blank,please check it.");
- }
-
- // validate receiveIdType
- if (!StringUtils.containsAny(receiveIdType, ReceiveIdTypeEnum.CHAT_ID.getValue(),
- ReceiveIdTypeEnum.EMAIL.getValue(),
- ReceiveIdTypeEnum.OPEN_ID.getValue(),
- ReceiveIdTypeEnum.USER_ID.getValue(),
- ReceiveIdTypeEnum.UNION_ID.getValue())) {
- throw new IllegalArgumentException(
- String.format("sinkConnectorConfig.receiveIdType=[%s], Invalid.", receiveIdType));
- }
- }
}
diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSinkConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSinkConfig.java
index 9bb79551db..973eed11ff 100644
--- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/KafkaSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSinkConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.kafka.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.kafka;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class KafkaSinkConfig extends SinkConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSourceConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSourceConfig.java
index 4319ec96d7..bf44a82710 100644
--- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/KafkaSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/KafkaSourceConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.kafka.source.config;
+package org.apache.eventmesh.common.config.connector.mq.kafka;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class KafkaSourceConfig extends SourceConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SinkConnectorConfig.java
similarity index 96%
rename from eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SinkConnectorConfig.java
index a240bf4f49..e7584319cb 100644
--- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.kafka.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.kafka;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SourceConnectorConfig.java
index 2d2f52f85c..eb7406f664 100644
--- a/eventmesh-connectors/eventmesh-connector-kafka/src/main/java/org/apache/eventmesh/connector/kafka/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/kafka/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.kafka.source.config;
+package org.apache.eventmesh.common.config.connector.mq.kafka;
import lombok.Data;
@@ -32,5 +32,4 @@ public class SourceConnectorConfig {
private String enableAutoCommit = "false";
private String sessionTimeoutMS = "10000";
private String maxPollRecords = "1000";
- private int pollTimeOut = 100;
}
diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSinkConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSinkConfig.java
index 8d7bfe384b..8cbfd5fb2c 100644
--- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/PulsarSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSinkConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pulsar.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.pulsar;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class PulsarSinkConfig extends SinkConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSourceConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSourceConfig.java
index a80c2a0e50..43eb2ca854 100644
--- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/PulsarSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/PulsarSourceConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pulsar.source.config;
+package org.apache.eventmesh.common.config.connector.mq.pulsar;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class PulsarSourceConfig extends SourceConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SinkConnectorConfig.java
index e1ebba09cb..b66f1a5324 100644
--- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pulsar.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.pulsar;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SourceConnectorConfig.java
index bb8ff46875..9f8fbce2d2 100644
--- a/eventmesh-connectors/eventmesh-connector-pulsar/src/main/java/org/apache/eventmesh/connector/pulsar/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/pulsar/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pulsar.source.config;
+package org.apache.eventmesh.common.config.connector.mq.pulsar;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSinkConfig.java
index 1c4ec66d47..8dcb8ad50c 100644
--- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/RabbitMQSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rabbitmq.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.rabbitmq;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSourceConfig.java
index 55ce402ae7..c268c1005a 100644
--- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/RabbitMQSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/RabbitMQSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rabbitmq.source.config;
+package org.apache.eventmesh.common.config.connector.mq.rabbitmq;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SinkConnectorConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SinkConnectorConfig.java
index 358964bdc0..a6f633f943 100644
--- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SinkConnectorConfig.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rabbitmq.sink.config;
-
-import com.rabbitmq.client.BuiltinExchangeType;
+package org.apache.eventmesh.common.config.connector.mq.rabbitmq;
import lombok.Data;
@@ -36,7 +34,7 @@ public class SinkConnectorConfig {
private String virtualHost;
- private BuiltinExchangeType exchangeType;
+ private String exchangeType;
private String exchangeName;
diff --git a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SourceConnectorConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SourceConnectorConfig.java
index d83149f9ca..29a041338f 100644
--- a/eventmesh-connectors/eventmesh-connector-rabbitmq/src/main/java/org/apache/eventmesh/connector/rabbitmq/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rabbitmq/SourceConnectorConfig.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rabbitmq.source.config;
-
-import com.rabbitmq.client.BuiltinExchangeType;
+package org.apache.eventmesh.common.config.connector.mq.rabbitmq;
import lombok.Data;
@@ -36,7 +34,7 @@ public class SourceConnectorConfig {
private String virtualHost;
- private BuiltinExchangeType exchangeType;
+ private String exchangeType;
private String exchangeName;
diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSinkConfig.java
index bc4191c9bf..d7c08e8b79 100644
--- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/RocketMQSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rocketmq.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.rocketmq;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSourceConfig.java
index 43a74fabd4..5c531d91c7 100644
--- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/RocketMQSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/RocketMQSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rocketmq.source.config;
+package org.apache.eventmesh.common.config.connector.mq.rocketmq;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SinkConnectorConfig.java
index 034dd7ce0c..93472f7a4c 100644
--- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rocketmq.sink.config;
+package org.apache.eventmesh.common.config.connector.mq.rocketmq;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SourceConnectorConfig.java
index 1dc8a0d5c9..641d1873bb 100644
--- a/eventmesh-connectors/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/mq/rocketmq/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.rocketmq.source.config;
+package org.apache.eventmesh.common.config.connector.mq.rocketmq;
import lombok.Data;
diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/offset/OffsetStorageConfig.java
similarity index 82%
rename from eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/offset/OffsetStorageConfig.java
index 30a56a3d2f..60448d3691 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/config/OffsetStorageConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/offset/OffsetStorageConfig.java
@@ -15,7 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.offsetmgmt.api.config;
+package org.apache.eventmesh.common.config.connector.offset;
+
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
import java.util.Map;
@@ -29,4 +31,8 @@ public class OffsetStorageConfig {
private String offsetStorageAddr;
private Map extensions;
+
+ private DataSourceType dataSourceType;
+
+ private DataSourceType dataSinkType;
}
diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSinkConfig.java
index 6e4fbe3dc4..151ff68834 100644
--- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/OpenFunctionSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.openfunction.sink.config;
+package org.apache.eventmesh.common.config.connector.openfunction;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSourceConfig.java
index f3f5b52756..e3a6123ed9 100644
--- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/OpenFunctionSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/OpenFunctionSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.openfunction.source.config;
+package org.apache.eventmesh.common.config.connector.openfunction;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SinkConnectorConfig.java
index 77c1b7c701..b8bc937390 100644
--- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.openfunction.sink.config;
+package org.apache.eventmesh.common.config.connector.openfunction;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SourceConnectorConfig.java
index 93fc9739fc..09dbdea14c 100644
--- a/eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/openfunction/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.openfunction.source.config;
+package org.apache.eventmesh.common.config.connector.openfunction;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSinkConfig.java
index 739c6539b5..a94766c20c 100644
--- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/PravegaSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pravega.sink.config;
+package org.apache.eventmesh.common.config.connector.pravega;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSourceConfig.java
index 87fbd3d573..105d3474ee 100644
--- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/PravegaSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/PravegaSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pravega.source.config;
+package org.apache.eventmesh.common.config.connector.pravega;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SinkConnectorConfig.java
similarity index 95%
rename from eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SinkConnectorConfig.java
index c254dee3b8..7f56ea57a8 100644
--- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pravega.sink.config;
+package org.apache.eventmesh.common.config.connector.pravega;
import java.net.URI;
diff --git a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SourceConnectorConfig.java
similarity index 95%
rename from eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SourceConnectorConfig.java
index 1ff54d1c1c..da0f8c5f13 100644
--- a/eventmesh-connectors/eventmesh-connector-pravega/src/main/java/org/apache/eventmesh/connector/pravega/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/pravega/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.pravega.source.config;
+package org.apache.eventmesh.common.config.connector.pravega;
import java.net.URI;
diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/PrometheusSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/PrometheusSourceConfig.java
index 292b7e62f1..3393e4a193 100644
--- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/PrometheusSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/PrometheusSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.prometheus.source.config;
+package org.apache.eventmesh.common.config.connector.prometheus;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/SourceConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/SourceConnectorConfig.java
index 7e8b7ba93e..1df3fe18cb 100644
--- a/eventmesh-connectors/eventmesh-connector-prometheus/src/main/java/org/apache/eventmesh/connector/prometheus/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/prometheus/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.prometheus.source.config;
+package org.apache.eventmesh.common.config.connector.prometheus;
import lombok.Data;
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/JdbcConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/JdbcConfig.java
new file mode 100644
index 0000000000..fc784fc187
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/JdbcConfig.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.common.config.connector.rdb;
+
+import org.apache.eventmesh.common.config.connector.rdb.canal.RdbDBDefinition;
+
+import java.util.Set;
+
+import lombok.Data;
+
+@Data
+public class JdbcConfig {
+ private String url;
+
+ private String dbAddress;
+
+ private int dbPort;
+
+ private String userName;
+
+ private String passWord;
+
+ private Set databases;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalMySQLType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalMySQLType.java
new file mode 100644
index 0000000000..b5107ccbf3
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalMySQLType.java
@@ -0,0 +1,191 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.mysql.cj.MysqlType;
+
+public enum CanalMySQLType {
+ BIT("BIT"),
+ TINYINT("TINYINT"),
+ SMALLINT("SMALLINT"),
+ MEDIUMINT("MEDIUMINT"),
+ INT("INT"),
+ BIGINT("BIGINT"),
+ DECIMAL("DECIMAL"),
+ FLOAT("FLOAT"),
+ DOUBLE("DOUBLE"),
+ DATE("DATE"),
+ DATETIME("DATETIME"),
+ TIMESTAMP("TIMESTAMP"),
+ TIME("TIME"),
+ YEAR("YEAR"),
+ CHAR("CHAR"),
+ VARCHAR("VARCHAR"),
+ BINARY("BINARY"),
+ VARBINARY("VARBINARY"),
+ TINYBLOB("TINYBLOB"),
+ BLOB("BLOB"),
+ MEDIUMBLOB("MEDIUMBLOB"),
+ LONGBLOB("LONGBLOB"),
+ TINYTEXT("TINYTEXT"),
+ TEXT("TEXT"),
+ MEDIUMTEXT("MEDIUMTEXT"),
+ LONGTEXT("LONGTEXT"),
+ ENUM("ENUM"),
+ SET("SET"),
+ JSON("JSON"),
+ GEOMETRY("GEOMETRY"),
+ // MysqlType not include the following type
+ POINT("POINT"),
+ LINESTRING("LINESTRING"),
+ POLYGON("POLYGON"),
+ MULTIPOINT("MULTIPOINT"),
+ GEOMETRY_COLLECTION("GEOMETRYCOLLECTION"),
+ GEOM_COLLECTION("GEOMCOLLECTION"),
+ MULTILINESTRING("MULTILINESTRING"),
+ MULTIPOLYGON("MULTIPOLYGON");
+
+ private final String codeKey;
+ private final MysqlType mysqlType;
+
+ CanalMySQLType(String codeKey) {
+ this.codeKey = codeKey;
+ this.mysqlType = MysqlType.getByName(codeKey);
+ }
+
+ private static final Map TYPES = new HashMap<>();
+
+ static {
+ CanalMySQLType[] values = values();
+ for (CanalMySQLType tableType : values) {
+ TYPES.put(tableType.codeKey, tableType);
+ }
+ }
+
+ public String genPrepareStatement4Insert() {
+ switch (this) {
+ case GEOMETRY:
+ case GEOM_COLLECTION:
+ case GEOMETRY_COLLECTION:
+ return "ST_GEOMFROMTEXT(?)";
+ case POINT:
+ return "ST_PointFromText(?)";
+ case LINESTRING:
+ return "ST_LineStringFromText(?)";
+ case POLYGON:
+ return "ST_PolygonFromText(?)";
+ case MULTIPOINT:
+ return "ST_MultiPointFromText(?)";
+ case MULTILINESTRING:
+ return "ST_MultiLineStringFromText(?)";
+ case MULTIPOLYGON:
+ return "ST_MultiPolygonFromText(?)";
+ default:
+ return "?";
+ }
+ }
+
+ public static CanalMySQLType valueOfCode(String code) {
+ CanalMySQLType type = TYPES.get(code.toUpperCase());
+ if (type != null) {
+ return type;
+ }
+ switch (MysqlType.getByName(code)) {
+ case BOOLEAN:
+ case TINYINT:
+ case TINYINT_UNSIGNED:
+ return TINYINT;
+ case SMALLINT:
+ case SMALLINT_UNSIGNED:
+ return SMALLINT;
+ case INT:
+ case INT_UNSIGNED:
+ return INT;
+ case BIGINT:
+ case BIGINT_UNSIGNED:
+ return BIGINT;
+ case MEDIUMINT:
+ case MEDIUMINT_UNSIGNED:
+ return MEDIUMINT;
+ case DECIMAL:
+ case DECIMAL_UNSIGNED:
+ return DECIMAL;
+ case FLOAT:
+ case FLOAT_UNSIGNED:
+ return FLOAT;
+ case DOUBLE:
+ case DOUBLE_UNSIGNED:
+ return DOUBLE;
+ case BIT:
+ return BIT;
+ case BINARY:
+ return BINARY;
+ case VARBINARY:
+ return VARBINARY;
+ case TINYBLOB:
+ return TINYBLOB;
+ case MEDIUMBLOB:
+ return MEDIUMBLOB;
+ case LONGBLOB:
+ return LONGBLOB;
+ case BLOB:
+ return BLOB;
+ case CHAR:
+ return CHAR;
+ case VARCHAR:
+ return VARCHAR;
+ case TINYTEXT:
+ return TINYTEXT;
+ case MEDIUMTEXT:
+ return MEDIUMTEXT;
+ case LONGTEXT:
+ return LONGTEXT;
+ case TEXT:
+ return TEXT;
+ case DATE:
+ return DATE;
+ case TIME:
+ return TIME;
+ case TIMESTAMP:
+ return TIMESTAMP;
+ case DATETIME:
+ return DATETIME;
+ case YEAR:
+ return YEAR;
+ case JSON:
+ return JSON;
+ case ENUM:
+ return ENUM;
+ case SET:
+ return SET;
+ case GEOMETRY:
+ return GEOMETRY;
+ case NULL:
+ case UNKNOWN:
+ default:
+ throw new UnsupportedOperationException("Unsupported mysql columnType " + code);
+ }
+ }
+
+ public MysqlType getMysqlType() {
+ return mysqlType;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkConfig.java
new file mode 100644
index 0000000000..c535c7f52a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkConfig.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.SinkConfig;
+
+import java.util.Map;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSinkConfig extends SinkConfig {
+
+ // used to convert canal full/increment/check connector config
+ private Map sinkConfig;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkFullConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkFullConfig.java
new file mode 100644
index 0000000000..dca16b100c
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkFullConfig.java
@@ -0,0 +1,32 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.SinkConfig;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSinkFullConfig extends SinkConfig {
+ private SinkConnectorConfig sinkConnectorConfig;
+ private String zeroDate;
+ private int parallel = 2;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkIncrementConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkIncrementConfig.java
new file mode 100644
index 0000000000..aeb9d5a0e2
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkIncrementConfig.java
@@ -0,0 +1,50 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.remote.job.SyncMode;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSinkIncrementConfig extends CanalSinkConfig {
+
+ // batchSize
+ private Integer batchSize = 50;
+
+ // enable batch
+ private Boolean useBatch = true;
+
+ // sink thread size for single channel
+ private Integer poolSize = 5;
+
+ // sync mode: field/row
+ private SyncMode syncMode = SyncMode.ROW;
+
+ private boolean isGTIDMode = false;
+
+ private boolean isMariaDB = true;
+
+ // skip sink process exception
+ private Boolean skipException = false;
+
+ public SinkConnectorConfig sinkConnectorConfig;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceCheckConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceCheckConfig.java
new file mode 100644
index 0000000000..f326301d7d
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceCheckConfig.java
@@ -0,0 +1,38 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.SourceConfig;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSourceCheckConfig extends SourceConfig {
+ private SourceConnectorConfig sourceConnectorConfig;
+ private List startPosition;
+ private int parallel;
+ private int flushSize;
+ private int executePeriod = 3600;
+ private Integer pagePerSecond = 1;
+ private Integer recordPerSecond = 100;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceConfig.java
new file mode 100644
index 0000000000..db17fbe75d
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceConfig.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.SourceConfig;
+
+import java.util.Map;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSourceConfig extends SourceConfig {
+
+ // used to convert canal full/increment/check connector config
+ private Map sourceConfig;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceFullConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceFullConfig.java
new file mode 100644
index 0000000000..53988ca055
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceFullConfig.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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.SourceConfig;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSourceFullConfig extends SourceConfig {
+ private SourceConnectorConfig sourceConnectorConfig;
+ private List startPosition;
+ private int parallel = 2;
+ private int flushSize = 20;
+ private Integer pagePerSecond = 1;
+ private Integer recordPerSecond = 100;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceIncrementConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceIncrementConfig.java
new file mode 100644
index 0000000000..7f73727140
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceIncrementConfig.java
@@ -0,0 +1,86 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.remote.job.SyncConsistency;
+import org.apache.eventmesh.common.remote.job.SyncMode;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CanalSourceIncrementConfig extends CanalSourceConfig {
+
+ private String destination;
+
+ private Long canalInstanceId = 1L;
+
+ private String desc = "canalSourceInstance";
+
+ private boolean ddlSync = false;
+
+ private boolean filterTableError = false;
+
+ private Long slaveId;
+
+ private Short clientId = 1;
+
+ private String serverUUID;
+
+ private boolean isMariaDB = true;
+
+ private boolean isGTIDMode = true;
+
+ private Integer batchSize = 10000;
+
+ private Long batchTimeout = -1L;
+
+ private String tableFilter;
+
+ private String fieldFilter;
+
+ private List recordPositions;
+
+ // ================================= channel parameter
+ // ================================
+
+ // enable remedy
+ private Boolean enableRemedy = false;
+
+ // sync mode: field/row
+ private SyncMode syncMode = SyncMode.ROW;
+
+ // sync consistency
+ private SyncConsistency syncConsistency = SyncConsistency.BASE;
+
+ // ================================= system parameter
+ // ================================
+
+ // Column name of the bidirectional synchronization mark
+ private String needSyncMarkTableColumnName;
+
+ // Column value of the bidirectional synchronization mark
+ private String needSyncMarkTableColumnValue;
+
+ private SourceConnectorConfig sourceConnectorConfig;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/JobRdbFullPosition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/JobRdbFullPosition.java
new file mode 100644
index 0000000000..42ba889bbd
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/JobRdbFullPosition.java
@@ -0,0 +1,36 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import java.math.BigDecimal;
+
+import lombok.Data;
+import lombok.ToString;
+
+@Data
+@ToString
+public class JobRdbFullPosition {
+ private String jobId;
+ private String schema;
+ private String tableName;
+ private String primaryKeyRecords;
+ private long maxCount;
+ private long handledRecordCount = 0;
+ private boolean finished;
+ private BigDecimal percent;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbColumnDefinition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbColumnDefinition.java
new file mode 100644
index 0000000000..94c0135c3e
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbColumnDefinition.java
@@ -0,0 +1,28 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import java.sql.JDBCType;
+
+import lombok.Data;
+
+@Data
+public class RdbColumnDefinition {
+ protected String name;
+ protected JDBCType jdbcType;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java
new file mode 100644
index 0000000000..ab3ed336f8
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java
@@ -0,0 +1,31 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import java.util.Set;
+
+import lombok.Data;
+
+/**
+ * Description: as class name
+ */
+@Data
+public class RdbDBDefinition {
+ private String schemaName;
+ private Set tables;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbTableDefinition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbTableDefinition.java
new file mode 100644
index 0000000000..c281035578
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbTableDefinition.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.common.config.connector.rdb.canal;
+
+import lombok.Data;
+
+/**
+ * Description: as class name
+ */
+@Data
+public class RdbTableDefinition {
+ protected String schemaName;
+ protected String tableName;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SinkConnectorConfig.java
new file mode 100644
index 0000000000..761cdba4bb
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SinkConnectorConfig.java
@@ -0,0 +1,32 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.rdb.JdbcConfig;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Configuration parameters for a sink connector.
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SinkConnectorConfig extends JdbcConfig {
+ private String connectorName;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SourceConnectorConfig.java
new file mode 100644
index 0000000000..9a95696a0d
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/SourceConnectorConfig.java
@@ -0,0 +1,32 @@
+/*
+ * 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.common.config.connector.rdb.canal;
+
+import org.apache.eventmesh.common.config.connector.rdb.JdbcConfig;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Represents the configuration for a database connector.
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SourceConnectorConfig extends JdbcConfig {
+ private String connectorName;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/Constants.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/Constants.java
new file mode 100644
index 0000000000..8c51c7255b
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/Constants.java
@@ -0,0 +1,22 @@
+/*
+ * 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.common.config.connector.rdb.canal.mysql;
+
+public class Constants {
+ public static final String MySQLQuot = "`";
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLColumnDef.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLColumnDef.java
new file mode 100644
index 0000000000..cdc9adf33f
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLColumnDef.java
@@ -0,0 +1,30 @@
+/*
+ * 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.common.config.connector.rdb.canal.mysql;
+
+import org.apache.eventmesh.common.config.connector.rdb.canal.CanalMySQLType;
+import org.apache.eventmesh.common.config.connector.rdb.canal.RdbColumnDefinition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MySQLColumnDef extends RdbColumnDefinition {
+ private CanalMySQLType type;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLTableDef.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLTableDef.java
new file mode 100644
index 0000000000..4266a96060
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/mysql/MySQLTableDef.java
@@ -0,0 +1,36 @@
+/*
+ * 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.common.config.connector.rdb.canal.mysql;
+
+import org.apache.eventmesh.common.config.connector.rdb.canal.RdbTableDefinition;
+
+import java.util.List;
+import java.util.Map;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description:
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MySQLTableDef extends RdbTableDefinition {
+ private List primaryKeys;
+ private Map columnDefinitions;
+}
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcConfig.java
similarity index 96%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcConfig.java
index d40801854c..1b46a76c99 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/config/JdbcConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.config;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
import java.util.Properties;
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSinkConfig.java
index 2a5af32cad..83711c68be 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/JdbcSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.sink.config;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSourceConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSourceConfig.java
index b330c331bf..553a0581a2 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/JdbcSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/JdbcSourceConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.source.config;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/MysqlConfig.java
similarity index 95%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/MysqlConfig.java
index 032921350f..ede507e1be 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/MysqlConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/MysqlConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.source.config;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SinkConnectorConfig.java
similarity index 90%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SinkConnectorConfig.java
index e971b7b000..afbd51d143 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SinkConnectorConfig.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.sink.config;
-
-import org.apache.eventmesh.connector.jdbc.config.JdbcConfig;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SourceConnectorConfig.java
similarity index 95%
rename from eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SourceConnectorConfig.java
index a27dbfedb4..a10d8e09d0 100644
--- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/jdbc/SourceConnectorConfig.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.jdbc.source.config;
-
-import org.apache.eventmesh.connector.jdbc.config.JdbcConfig;
+package org.apache.eventmesh.common.config.connector.rdb.jdbc;
import java.util.List;
diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSinkConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSinkConfig.java
index 6df203bd6a..7d019ba1ff 100644
--- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/MongodbSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSinkConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.mongodb.sink.config;
+package org.apache.eventmesh.common.config.connector.rdb.mongodb;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class MongodbSinkConfig extends SinkConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSourceConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSourceConfig.java
index d67ad6c277..00dca10b29 100644
--- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/MongodbSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/MongodbSourceConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.mongodb.source.config;
+package org.apache.eventmesh.common.config.connector.rdb.mongodb;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class MongodbSourceConfig extends SourceConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SinkConnectorConfig.java
index 087b2e48ce..58ae5ffc42 100644
--- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.mongodb.sink.config;
+package org.apache.eventmesh.common.config.connector.rdb.mongodb;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SourceConnectorConfig.java
index 5c48645a43..8ace602f80 100644
--- a/eventmesh-connectors/eventmesh-connector-mongodb/src/main/java/org/apache/eventmesh/connector/mongodb/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/mongodb/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.mongodb.source.config;
+package org.apache.eventmesh.common.config.connector.rdb.mongodb;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSinkConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSinkConfig.java
index 62cddbf312..27070343d4 100644
--- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/RedisSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSinkConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.redis.sink.config;
+package org.apache.eventmesh.common.config.connector.redis;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class RedisSinkConfig extends SinkConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSourceConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSourceConfig.java
index f01a556c9f..5b04e6a820 100644
--- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/RedisSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/RedisSourceConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.redis.source.config;
+package org.apache.eventmesh.common.config.connector.redis;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class RedisSourceConfig extends SourceConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SinkConnectorConfig.java
index 34fb0326a4..ebf53adc3b 100644
--- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.redis.sink.config;
+package org.apache.eventmesh.common.config.connector.redis;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SourceConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SourceConnectorConfig.java
index 9913e16320..b363924ecb 100644
--- a/eventmesh-connectors/eventmesh-connector-redis/src/main/java/org/apache/eventmesh/connector/redis/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/redis/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.redis.source.config;
+package org.apache.eventmesh.common.config.connector.redis;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/S3SourceConfig.java
similarity index 83%
rename from eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/S3SourceConfig.java
index 0f4bec5d56..7691b6e235 100644
--- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/S3SourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/S3SourceConfig.java
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.s3.source.config;
+package org.apache.eventmesh.common.config.connector.s3;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+@EqualsAndHashCode(callSuper = true)
@Data
public class S3SourceConfig extends SourceConfig {
diff --git a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/SourceConnectorConfig.java
similarity index 96%
rename from eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/SourceConnectorConfig.java
index 2c9cb5a80c..fdc4531255 100644
--- a/eventmesh-connectors/eventmesh-connector-s3/src/main/java/org/apache/eventmesh/connector/s3/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/s3/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.s3.source.config;
+package org.apache.eventmesh.common.config.connector.s3;
import java.util.Map;
diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SinkConnectorConfig.java
index 41884a94a1..4267beddff 100644
--- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.slack.sink.config;
+package org.apache.eventmesh.common.config.connector.slack;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SlackSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SlackSinkConfig.java
index 016cd9ae97..969306ae6e 100644
--- a/eventmesh-connectors/eventmesh-connector-slack/src/main/java/org/apache/eventmesh/connector/slack/sink/config/SlackSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/slack/SlackSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.slack.sink.config;
+package org.apache.eventmesh.common.config.connector.slack;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SinkConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SinkConnectorConfig.java
index a71c4ab66c..0ded9886dc 100644
--- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/connector/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.spring.sink.connector;
+package org.apache.eventmesh.common.config.connector.spring;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SourceConnectorConfig.java
similarity index 93%
rename from eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SourceConnectorConfig.java
index 242869087f..c31f8c9885 100644
--- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/connector/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SourceConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.spring.source.connector;
+package org.apache.eventmesh.common.config.connector.spring;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSinkConfig.java
similarity index 83%
rename from eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSinkConfig.java
index aff0d8a0f3..14f1f4bbe5 100644
--- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/config/SpringSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSinkConfig.java
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.spring.sink.config;
+package org.apache.eventmesh.common.config.connector.spring;
-import org.apache.eventmesh.connector.spring.sink.connector.SinkConnectorConfig;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSourceConfig.java
similarity index 82%
rename from eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSourceConfig.java
index 191e9b1196..e99dfc594c 100644
--- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/source/config/SpringSourceConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/spring/SpringSourceConfig.java
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.spring.source.config;
+package org.apache.eventmesh.common.config.connector.spring;
-import org.apache.eventmesh.connector.spring.source.connector.SourceConnectorConfig;
-import org.apache.eventmesh.openconnect.api.config.SourceConfig;
+import org.apache.eventmesh.common.config.connector.SourceConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/SinkConnectorConfig.java
index e575e65c67..95ca5e64c2 100644
--- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.wechat.sink.config;
+package org.apache.eventmesh.common.config.connector.wechat;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/WeChatSinkConfig.java
similarity index 88%
rename from eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/WeChatSinkConfig.java
index a77e1c77b5..e968202c4c 100644
--- a/eventmesh-connectors/eventmesh-connector-wechat/src/main/java/org/apache/eventmesh/connector/wechat/sink/config/WeChatSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wechat/WeChatSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.wechat.sink.config;
+package org.apache.eventmesh.common.config.connector.wechat;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/SinkConnectorConfig.java
similarity index 94%
rename from eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/SinkConnectorConfig.java
index 013d5a8bb7..b32b5b7d36 100644
--- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/SinkConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/SinkConnectorConfig.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.wecom.sink.config;
+package org.apache.eventmesh.common.config.connector.wecom;
import lombok.Data;
diff --git a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/WeComSinkConfig.java
similarity index 89%
rename from eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/WeComSinkConfig.java
index 8af43bdbe8..5177baa448 100644
--- a/eventmesh-connectors/eventmesh-connector-wecom/src/main/java/org/apache/eventmesh/connector/wecom/sink/config/WeComSinkConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/wecom/WeComSinkConfig.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.wecom.sink.config;
+package org.apache.eventmesh.common.config.connector.wecom;
-import org.apache.eventmesh.openconnect.api.config.SinkConfig;
+import org.apache.eventmesh.common.config.connector.SinkConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ComponentType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ComponentType.java
new file mode 100644
index 0000000000..a48e3fe013
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ComponentType.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.enums;
+
+public enum ComponentType {
+ CONNECTOR("connector"),
+ FUNCTION("function"),
+ MESH("mesh");
+
+ public String name;
+
+ ComponentType(String name) {
+ this.name = name;
+ }
+
+ public String componentTypeName() {
+ return this.name;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ConnectorStage.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ConnectorStage.java
new file mode 100644
index 0000000000..90265fba4a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/enums/ConnectorStage.java
@@ -0,0 +1,23 @@
+/*
+ * 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.common.enums;
+
+public enum ConnectorStage {
+ SOURCE,
+ SINK
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/AdminServiceGrpc.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/AdminServiceGrpc.java
new file mode 100644
index 0000000000..df5f3ef338
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/AdminServiceGrpc.java
@@ -0,0 +1,373 @@
+/*
+ * 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.common.protocol.grpc.adminserver;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+
+/**
+ * AdminServiceGrpc
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.40.0)",
+ comments = "Source: event_mesh_admin_service.proto")
+@io.grpc.stub.annotations.GrpcGenerated
+public final class AdminServiceGrpc {
+
+ private AdminServiceGrpc() {
+ }
+
+ public static final String SERVICE_NAME = "AdminService";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor getInvokeBiStreamMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "invokeBiStream",
+ requestType = Payload.class,
+ responseType = Payload.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ public static io.grpc.MethodDescriptor getInvokeBiStreamMethod() {
+ io.grpc.MethodDescriptor getInvokeBiStreamMethod;
+ if ((getInvokeBiStreamMethod = AdminServiceGrpc.getInvokeBiStreamMethod) == null) {
+ synchronized (AdminServiceGrpc.class) {
+ if ((getInvokeBiStreamMethod = AdminServiceGrpc.getInvokeBiStreamMethod) == null) {
+ AdminServiceGrpc.getInvokeBiStreamMethod = getInvokeBiStreamMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "invokeBiStream"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ Payload.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ Payload.getDefaultInstance()))
+ .setSchemaDescriptor(new AdminServiceMethodDescriptorSupplier("invokeBiStream"))
+ .build();
+ }
+ }
+ }
+ return getInvokeBiStreamMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getInvokeMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "invoke",
+ requestType = Payload.class,
+ responseType = Payload.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getInvokeMethod() {
+ io.grpc.MethodDescriptor getInvokeMethod;
+ if ((getInvokeMethod = AdminServiceGrpc.getInvokeMethod) == null) {
+ synchronized (AdminServiceGrpc.class) {
+ if ((getInvokeMethod = AdminServiceGrpc.getInvokeMethod) == null) {
+ AdminServiceGrpc.getInvokeMethod = getInvokeMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "invoke"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ Payload.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ Payload.getDefaultInstance()))
+ .setSchemaDescriptor(new AdminServiceMethodDescriptorSupplier("invoke"))
+ .build();
+ }
+ }
+ }
+ return getInvokeMethod;
+ }
+
+ /**
+ * Creates a new async stub that supports all call types for the service
+ */
+ public static AdminServiceStub newStub(io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @Override
+ public AdminServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceStub(channel, callOptions);
+ }
+ };
+ return AdminServiceStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+ */
+ public static AdminServiceBlockingStub newBlockingStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @Override
+ public AdminServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceBlockingStub(channel, callOptions);
+ }
+ };
+ return AdminServiceBlockingStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new ListenableFuture-style stub that supports unary calls on the service
+ */
+ public static AdminServiceFutureStub newFutureStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @Override
+ public AdminServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceFutureStub(channel, callOptions);
+ }
+ };
+ return AdminServiceFutureStub.newStub(factory, channel);
+ }
+
+ /**
+ *
+ */
+ public static abstract class AdminServiceImplBase implements io.grpc.BindableService {
+
+ /**
+ *
+ */
+ public io.grpc.stub.StreamObserver invokeBiStream(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getInvokeBiStreamMethod(), responseObserver);
+ }
+
+ /**
+ *
+ */
+ public void invoke(Payload request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getInvokeMethod(), responseObserver);
+ }
+
+ @Override
+ public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getInvokeBiStreamMethod(),
+ io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
+ new MethodHandlers<
+ Payload,
+ Payload>(
+ this, METHODID_INVOKE_BI_STREAM)))
+ .addMethod(
+ getInvokeMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ Payload,
+ Payload>(
+ this, METHODID_INVOKE)))
+ .build();
+ }
+ }
+
+ /**
+ *
+ */
+ public static final class AdminServiceStub extends io.grpc.stub.AbstractAsyncStub {
+
+ private AdminServiceStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected AdminServiceStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceStub(channel, callOptions);
+ }
+
+ /**
+ *
+ */
+ public io.grpc.stub.StreamObserver invokeBiStream(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
+ getChannel().newCall(getInvokeBiStreamMethod(), getCallOptions()), responseObserver);
+ }
+
+ /**
+ *
+ */
+ public void invoke(Payload request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getInvokeMethod(), getCallOptions()), request, responseObserver);
+ }
+ }
+
+ /**
+ *
+ */
+ public static final class AdminServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub {
+
+ private AdminServiceBlockingStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected AdminServiceBlockingStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceBlockingStub(channel, callOptions);
+ }
+
+ /**
+ *
+ */
+ public Payload invoke(Payload request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getInvokeMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ *
+ */
+ public static final class AdminServiceFutureStub extends io.grpc.stub.AbstractFutureStub {
+
+ private AdminServiceFutureStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @Override
+ protected AdminServiceFutureStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new AdminServiceFutureStub(channel, callOptions);
+ }
+
+ /**
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture invoke(
+ Payload request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getInvokeMethod(), getCallOptions()), request);
+ }
+ }
+
+ private static final int METHODID_INVOKE = 0;
+ private static final int METHODID_INVOKE_BI_STREAM = 1;
+
+ private static final class MethodHandlers implements
+ io.grpc.stub.ServerCalls.UnaryMethod,
+ io.grpc.stub.ServerCalls.ServerStreamingMethod,
+ io.grpc.stub.ServerCalls.ClientStreamingMethod,
+ io.grpc.stub.ServerCalls.BidiStreamingMethod {
+
+ private final AdminServiceImplBase serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(AdminServiceImplBase serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_INVOKE:
+ serviceImpl.invoke((Payload) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver invoke(
+ io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_INVOKE_BI_STREAM:
+ return (io.grpc.stub.StreamObserver) serviceImpl.invokeBiStream(
+ (io.grpc.stub.StreamObserver) responseObserver);
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ private static abstract class AdminServiceBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+
+ AdminServiceBaseDescriptorSupplier() {
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+ return EventMeshAdminService.getDescriptor();
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+ return getFileDescriptor().findServiceByName("AdminService");
+ }
+ }
+
+ private static final class AdminServiceFileDescriptorSupplier
+ extends AdminServiceBaseDescriptorSupplier {
+
+ AdminServiceFileDescriptorSupplier() {
+ }
+ }
+
+ private static final class AdminServiceMethodDescriptorSupplier
+ extends AdminServiceBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+
+ private final String methodName;
+
+ AdminServiceMethodDescriptorSupplier(String methodName) {
+ this.methodName = methodName;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+ return getServiceDescriptor().findMethodByName(methodName);
+ }
+ }
+
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (AdminServiceGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new AdminServiceFileDescriptorSupplier())
+ .addMethod(getInvokeBiStreamMethod())
+ .addMethod(getInvokeMethod())
+ .build();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/EventMeshAdminService.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/EventMeshAdminService.java
new file mode 100644
index 0000000000..d67ed4159a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/EventMeshAdminService.java
@@ -0,0 +1,99 @@
+/*
+ * 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.common.protocol.grpc.adminserver;// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: event_mesh_admin_service.proto
+
+public final class EventMeshAdminService {
+
+ private EventMeshAdminService() {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_Metadata_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_Metadata_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_Metadata_HeadersEntry_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_Metadata_HeadersEntry_fieldAccessorTable;
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_Payload_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_Payload_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+
+ static {
+ String[] descriptorData = {
+ "\n\036event_mesh_admin_service.proto\032\031google" +
+ "/protobuf/any.proto\"q\n\010Metadata\022\014\n\004type\030" +
+ "\003 \001(\t\022\'\n\007headers\030\007 \003(\0132\026.Metadata.Header" +
+ "sEntry\032.\n\014HeadersEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" +
+ "alue\030\002 \001(\t:\0028\001\"4\n\007Payload\022\033\n\010metadata\030\002 " +
+ "\001(\0132\t.Metadata\022\014\n\004body\030\003 \001(\0142Z\n\014AdminSer" +
+ "vice\022*\n\016invokeBiStream\022\010.Payload\032\010.Paylo" +
+ "ad\"\000(\0010\001\022\036\n\006invoke\022\010.Payload\032\010.Payload\"\000" +
+ "B\002P\001b\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ com.google.protobuf.AnyProto.getDescriptor(),
+ });
+ internal_static_Metadata_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_Metadata_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_Metadata_descriptor,
+ new String[] {"Type", "Headers",});
+ internal_static_Metadata_HeadersEntry_descriptor =
+ internal_static_Metadata_descriptor.getNestedTypes().get(0);
+ internal_static_Metadata_HeadersEntry_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_Metadata_HeadersEntry_descriptor,
+ new String[] {"Key", "Value",});
+ internal_static_Payload_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_Payload_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_Payload_descriptor,
+ new String[] {"Metadata", "Body",});
+ com.google.protobuf.AnyProto.getDescriptor();
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Metadata.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Metadata.java
new file mode 100644
index 0000000000..f25754f288
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Metadata.java
@@ -0,0 +1,962 @@
+/*
+ * 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.common.protocol.grpc.adminserver;// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: event_mesh_admin_service.proto
+
+/**
+ * Protobuf type {@code Metadata}
+ */
+public final class Metadata extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:Metadata)
+ MetadataOrBuilder {
+
+ private static final long serialVersionUID = 0L;
+
+ // Use Metadata.newBuilder() to construct.
+ private Metadata(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+
+ private Metadata() {
+ type_ = "";
+ }
+
+ @Override
+ @SuppressWarnings({"unused"})
+ protected Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new Metadata();
+ }
+
+ @Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ private Metadata(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new NullPointerException();
+ }
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 26: {
+ String s = input.readStringRequireUtf8();
+
+ type_ = s;
+ break;
+ }
+ case 58: {
+ if (!((mutable_bitField0_ & 0x00000001) != 0)) {
+ headers_ = com.google.protobuf.MapField.newMapField(
+ HeadersDefaultEntryHolder.defaultEntry);
+ mutable_bitField0_ |= 0x00000001;
+ }
+ com.google.protobuf.MapEntry
+ headers__ = input.readMessage(
+ HeadersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
+ headers_.getMutableMap().put(
+ headers__.getKey(), headers__.getValue());
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return EventMeshAdminService.internal_static_Metadata_descriptor;
+ }
+
+ @SuppressWarnings({"rawtypes"})
+ @Override
+ protected com.google.protobuf.MapField internalGetMapField(
+ int number) {
+ switch (number) {
+ case 7:
+ return internalGetHeaders();
+ default:
+ throw new RuntimeException(
+ "Invalid map field number: " + number);
+ }
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return EventMeshAdminService.internal_static_Metadata_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ Metadata.class, Builder.class);
+ }
+
+ public static final int TYPE_FIELD_NUMBER = 3;
+ private volatile Object type_;
+
+ /**
+ * string type = 3;
+ *
+ * @return The type.
+ */
+ @Override
+ public String getType() {
+ Object ref = type_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ type_ = s;
+ return s;
+ }
+ }
+
+ /**
+ * string type = 3;
+ *
+ * @return The bytes for type.
+ */
+ @Override
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int HEADERS_FIELD_NUMBER = 7;
+
+ private static final class HeadersDefaultEntryHolder {
+
+ static final com.google.protobuf.MapEntry<
+ String, String> defaultEntry =
+ com.google.protobuf.MapEntry
+ .newDefaultInstance(
+ EventMeshAdminService.internal_static_Metadata_HeadersEntry_descriptor,
+ com.google.protobuf.WireFormat.FieldType.STRING,
+ "",
+ com.google.protobuf.WireFormat.FieldType.STRING,
+ "");
+ }
+
+ private com.google.protobuf.MapField<
+ String, String> headers_;
+
+ private com.google.protobuf.MapField
+ internalGetHeaders() {
+ if (headers_ == null) {
+ return com.google.protobuf.MapField.emptyMapField(
+ HeadersDefaultEntryHolder.defaultEntry);
+ }
+ return headers_;
+ }
+
+ public int getHeadersCount() {
+ return internalGetHeaders().getMap().size();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ @Override
+ public boolean containsHeaders(
+ String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ return internalGetHeaders().getMap().containsKey(key);
+ }
+
+ /**
+ * Use {@link #getHeadersMap()} instead.
+ */
+ @Override
+ @Deprecated
+ public java.util.Map getHeaders() {
+ return getHeadersMap();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public java.util.Map getHeadersMap() {
+ return internalGetHeaders().getMap();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public String getHeadersOrDefault(
+ String key,
+ String defaultValue) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ java.util.Map map =
+ internalGetHeaders().getMap();
+ return map.containsKey(key) ? map.get(key) : defaultValue;
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public String getHeadersOrThrow(
+ String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ java.util.Map map =
+ internalGetHeaders().getMap();
+ if (!map.containsKey(key)) {
+ throw new IllegalArgumentException();
+ }
+ return map.get(key);
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getTypeBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 3, type_);
+ }
+ com.google.protobuf.GeneratedMessageV3
+ .serializeStringMapTo(
+ output,
+ internalGetHeaders(),
+ HeadersDefaultEntryHolder.defaultEntry,
+ 7);
+ unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (!getTypeBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, type_);
+ }
+ for (java.util.Map.Entry entry
+ : internalGetHeaders().getMap().entrySet()) {
+ com.google.protobuf.MapEntry
+ headers__ = HeadersDefaultEntryHolder.defaultEntry.newBuilderForType()
+ .setKey(entry.getKey())
+ .setValue(entry.getValue())
+ .build();
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(7, headers__);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof Metadata)) {
+ return super.equals(obj);
+ }
+ Metadata other = (Metadata) obj;
+
+ if (!getType()
+ .equals(other.getType())) {
+ return false;
+ }
+ if (!internalGetHeaders().equals(
+ other.internalGetHeaders())) {
+ return false;
+ }
+ if (!unknownFields.equals(other.unknownFields)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + TYPE_FIELD_NUMBER;
+ hash = (53 * hash) + getType().hashCode();
+ if (!internalGetHeaders().getMap().isEmpty()) {
+ hash = (37 * hash) + HEADERS_FIELD_NUMBER;
+ hash = (53 * hash) + internalGetHeaders().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static Metadata parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Metadata parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Metadata parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Metadata parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Metadata parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Metadata parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Metadata parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static Metadata parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static Metadata parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static Metadata parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static Metadata parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static Metadata parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(Metadata prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+
+ /**
+ * Protobuf type {@code Metadata}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:Metadata)
+ MetadataOrBuilder {
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return EventMeshAdminService.internal_static_Metadata_descriptor;
+ }
+
+ @SuppressWarnings({"rawtypes"})
+ protected com.google.protobuf.MapField internalGetMapField(
+ int number) {
+ switch (number) {
+ case 7:
+ return internalGetHeaders();
+ default:
+ throw new RuntimeException(
+ "Invalid map field number: " + number);
+ }
+ }
+
+ @SuppressWarnings({"rawtypes"})
+ protected com.google.protobuf.MapField internalGetMutableMapField(
+ int number) {
+ switch (number) {
+ case 7:
+ return internalGetMutableHeaders();
+ default:
+ throw new RuntimeException(
+ "Invalid map field number: " + number);
+ }
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return EventMeshAdminService.internal_static_Metadata_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ Metadata.class, Builder.class);
+ }
+
+ // Construct using Metadata.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+
+ @Override
+ public Builder clear() {
+ super.clear();
+ type_ = "";
+
+ internalGetMutableHeaders().clear();
+ return this;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return EventMeshAdminService.internal_static_Metadata_descriptor;
+ }
+
+ @Override
+ public Metadata getDefaultInstanceForType() {
+ return Metadata.getDefaultInstance();
+ }
+
+ @Override
+ public Metadata build() {
+ Metadata result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @Override
+ public Metadata buildPartial() {
+ Metadata result = new Metadata(this);
+ int from_bitField0_ = bitField0_;
+ result.type_ = type_;
+ result.headers_ = internalGetHeaders();
+ result.headers_.makeImmutable();
+ onBuilt();
+ return result;
+ }
+
+ @Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.setField(field, value);
+ }
+
+ @Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof Metadata) {
+ return mergeFrom((Metadata) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(Metadata other) {
+ if (other == Metadata.getDefaultInstance()) {
+ return this;
+ }
+ if (!other.getType().isEmpty()) {
+ type_ = other.type_;
+ onChanged();
+ }
+ internalGetMutableHeaders().mergeFrom(
+ other.internalGetHeaders());
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Metadata parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (Metadata) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private int bitField0_;
+
+ private Object type_ = "";
+
+ /**
+ * string type = 3;
+ *
+ * @return The type.
+ */
+ public String getType() {
+ Object ref = type_;
+ if (!(ref instanceof String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ type_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+
+ /**
+ * string type = 3;
+ *
+ * @return The bytes for type.
+ */
+ public com.google.protobuf.ByteString
+ getTypeBytes() {
+ Object ref = type_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (String) ref);
+ type_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ /**
+ * string type = 3;
+ *
+ * @param value The type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setType(
+ String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * string type = 3;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearType() {
+
+ type_ = getDefaultInstance().getType();
+ onChanged();
+ return this;
+ }
+
+ /**
+ * string type = 3;
+ *
+ * @param value The bytes for type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setTypeBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ private com.google.protobuf.MapField<
+ String, String> headers_;
+
+ private com.google.protobuf.MapField
+ internalGetHeaders() {
+ if (headers_ == null) {
+ return com.google.protobuf.MapField.emptyMapField(
+ HeadersDefaultEntryHolder.defaultEntry);
+ }
+ return headers_;
+ }
+
+ private com.google.protobuf.MapField
+ internalGetMutableHeaders() {
+ onChanged();
+ ;
+ if (headers_ == null) {
+ headers_ = com.google.protobuf.MapField.newMapField(
+ HeadersDefaultEntryHolder.defaultEntry);
+ }
+ if (!headers_.isMutable()) {
+ headers_ = headers_.copy();
+ }
+ return headers_;
+ }
+
+ public int getHeadersCount() {
+ return internalGetHeaders().getMap().size();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ @Override
+ public boolean containsHeaders(
+ String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ return internalGetHeaders().getMap().containsKey(key);
+ }
+
+ /**
+ * Use {@link #getHeadersMap()} instead.
+ */
+ @Override
+ @Deprecated
+ public java.util.Map getHeaders() {
+ return getHeadersMap();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public java.util.Map getHeadersMap() {
+ return internalGetHeaders().getMap();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public String getHeadersOrDefault(
+ String key,
+ String defaultValue) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ java.util.Map map =
+ internalGetHeaders().getMap();
+ return map.containsKey(key) ? map.get(key) : defaultValue;
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ @Override
+
+ public String getHeadersOrThrow(
+ String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ java.util.Map map =
+ internalGetHeaders().getMap();
+ if (!map.containsKey(key)) {
+ throw new IllegalArgumentException();
+ }
+ return map.get(key);
+ }
+
+ public Builder clearHeaders() {
+ internalGetMutableHeaders().getMutableMap()
+ .clear();
+ return this;
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ public Builder removeHeaders(
+ String key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ internalGetMutableHeaders().getMutableMap()
+ .remove(key);
+ return this;
+ }
+
+ /**
+ * Use alternate mutation accessors instead.
+ */
+ @Deprecated
+ public java.util.Map
+ getMutableHeaders() {
+ return internalGetMutableHeaders().getMutableMap();
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ public Builder putHeaders(
+ String key,
+ String value) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ internalGetMutableHeaders().getMutableMap()
+ .put(key, value);
+ return this;
+ }
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ public Builder putAllHeaders(
+ java.util.Map values) {
+ internalGetMutableHeaders().getMutableMap()
+ .putAll(values);
+ return this;
+ }
+
+ @Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+ // @@protoc_insertion_point(builder_scope:Metadata)
+ }
+
+ // @@protoc_insertion_point(class_scope:Metadata)
+ private static final Metadata DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new Metadata();
+ }
+
+ public static Metadata getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @Override
+ public Metadata parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Metadata(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public Metadata getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/MetadataOrBuilder.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/MetadataOrBuilder.java
new file mode 100644
index 0000000000..7afef491f8
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/MetadataOrBuilder.java
@@ -0,0 +1,78 @@
+/*
+ * 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.common.protocol.grpc.adminserver;// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: event_mesh_admin_service.proto
+
+public interface MetadataOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:Metadata)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ * string type = 3;
+ *
+ * @return The type.
+ */
+ String getType();
+
+ /**
+ * string type = 3;
+ *
+ * @return The bytes for type.
+ */
+ com.google.protobuf.ByteString
+ getTypeBytes();
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ int getHeadersCount();
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ boolean containsHeaders(
+ String key);
+
+ /**
+ * Use {@link #getHeadersMap()} instead.
+ */
+ @Deprecated
+ java.util.Map
+ getHeaders();
+
+ /**
+ * map<string, string> headers = 7;
+ */
+ java.util.Map
+ getHeadersMap();
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ String getHeadersOrDefault(
+ String key,
+ String defaultValue);
+
+ /**
+ * map<string, string> headers = 7;
+ */
+
+ String getHeadersOrThrow(
+ String key);
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Payload.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Payload.java
new file mode 100644
index 0000000000..a0067099a0
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/Payload.java
@@ -0,0 +1,893 @@
+/*
+ * 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.common.protocol.grpc.adminserver;// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: event_mesh_admin_service.proto
+
+/**
+ * Protobuf type {@code Payload}
+ */
+public final class Payload extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:Payload)
+ PayloadOrBuilder {
+
+ private static final long serialVersionUID = 0L;
+
+ // Use Payload.newBuilder() to construct.
+ private Payload(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+
+ private Payload() {
+ }
+
+ @Override
+ @SuppressWarnings({"unused"})
+ protected Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new Payload();
+ }
+
+ @Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ private Payload(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ this();
+ if (extensionRegistry == null) {
+ throw new NullPointerException();
+ }
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 18: {
+ Metadata.Builder subBuilder = null;
+ if (metadata_ != null) {
+ subBuilder = metadata_.toBuilder();
+ }
+ metadata_ = input.readMessage(Metadata.parser(), extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(metadata_);
+ metadata_ = subBuilder.buildPartial();
+ }
+
+ break;
+ }
+ case 26: {
+ com.google.protobuf.Any.Builder subBuilder = null;
+ if (body_ != null) {
+ subBuilder = body_.toBuilder();
+ }
+ body_ = input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(body_);
+ body_ = subBuilder.buildPartial();
+ }
+
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return EventMeshAdminService.internal_static_Payload_descriptor;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return EventMeshAdminService.internal_static_Payload_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ Payload.class, Builder.class);
+ }
+
+ public static final int METADATA_FIELD_NUMBER = 2;
+ private Metadata metadata_;
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return Whether the metadata field is set.
+ */
+ @Override
+ public boolean hasMetadata() {
+ return metadata_ != null;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return The metadata.
+ */
+ @Override
+ public Metadata getMetadata() {
+ return metadata_ == null ? Metadata.getDefaultInstance() : metadata_;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ @Override
+ public MetadataOrBuilder getMetadataOrBuilder() {
+ return getMetadata();
+ }
+
+ public static final int BODY_FIELD_NUMBER = 3;
+ private com.google.protobuf.Any body_;
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return Whether the body field is set.
+ */
+ @Override
+ public boolean hasBody() {
+ return body_ != null;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return The body.
+ */
+ @Override
+ public com.google.protobuf.Any getBody() {
+ return body_ == null ? com.google.protobuf.Any.getDefaultInstance() : body_;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ @Override
+ public com.google.protobuf.AnyOrBuilder getBodyOrBuilder() {
+ return getBody();
+ }
+
+ private byte memoizedIsInitialized = -1;
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (metadata_ != null) {
+ output.writeMessage(2, getMetadata());
+ }
+ if (body_ != null) {
+ output.writeMessage(3, getBody());
+ }
+ unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (metadata_ != null) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(2, getMetadata());
+ }
+ if (body_ != null) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(3, getBody());
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof Payload)) {
+ return super.equals(obj);
+ }
+ Payload other = (Payload) obj;
+
+ if (hasMetadata() != other.hasMetadata()) {
+ return false;
+ }
+ if (hasMetadata()) {
+ if (!getMetadata()
+ .equals(other.getMetadata())) {
+ return false;
+ }
+ }
+ if (hasBody() != other.hasBody()) {
+ return false;
+ }
+ if (hasBody()) {
+ if (!getBody()
+ .equals(other.getBody())) {
+ return false;
+ }
+ }
+ if (!unknownFields.equals(other.unknownFields)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ if (hasMetadata()) {
+ hash = (37 * hash) + METADATA_FIELD_NUMBER;
+ hash = (53 * hash) + getMetadata().hashCode();
+ }
+ if (hasBody()) {
+ hash = (37 * hash) + BODY_FIELD_NUMBER;
+ hash = (53 * hash) + getBody().hashCode();
+ }
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static Payload parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Payload parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Payload parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Payload parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Payload parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static Payload parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static Payload parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static Payload parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static Payload parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+
+ public static Payload parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static Payload parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static Payload parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(Payload prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+
+ /**
+ * Protobuf type {@code Payload}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:Payload)
+ PayloadOrBuilder {
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return EventMeshAdminService.internal_static_Payload_descriptor;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return EventMeshAdminService.internal_static_Payload_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ Payload.class, Builder.class);
+ }
+
+ // Construct using Payload.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+
+ @Override
+ public Builder clear() {
+ super.clear();
+ if (metadataBuilder_ == null) {
+ metadata_ = null;
+ } else {
+ metadata_ = null;
+ metadataBuilder_ = null;
+ }
+ if (bodyBuilder_ == null) {
+ body_ = null;
+ } else {
+ body_ = null;
+ bodyBuilder_ = null;
+ }
+ return this;
+ }
+
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return EventMeshAdminService.internal_static_Payload_descriptor;
+ }
+
+ @Override
+ public Payload getDefaultInstanceForType() {
+ return Payload.getDefaultInstance();
+ }
+
+ @Override
+ public Payload build() {
+ Payload result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @Override
+ public Payload buildPartial() {
+ Payload result = new Payload(this);
+ if (metadataBuilder_ == null) {
+ result.metadata_ = metadata_;
+ } else {
+ result.metadata_ = metadataBuilder_.build();
+ }
+ if (bodyBuilder_ == null) {
+ result.body_ = body_;
+ } else {
+ result.body_ = bodyBuilder_.build();
+ }
+ onBuilt();
+ return result;
+ }
+
+ @Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.setField(field, value);
+ }
+
+ @Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof Payload) {
+ return mergeFrom((Payload) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(Payload other) {
+ if (other == Payload.getDefaultInstance()) {
+ return this;
+ }
+ if (other.hasMetadata()) {
+ mergeMetadata(other.getMetadata());
+ }
+ if (other.hasBody()) {
+ mergeBody(other.getBody());
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Payload parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (Payload) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ private Metadata metadata_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ Metadata, Metadata.Builder, MetadataOrBuilder> metadataBuilder_;
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return Whether the metadata field is set.
+ */
+ public boolean hasMetadata() {
+ return metadataBuilder_ != null || metadata_ != null;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return The metadata.
+ */
+ public Metadata getMetadata() {
+ if (metadataBuilder_ == null) {
+ return metadata_ == null ? Metadata.getDefaultInstance() : metadata_;
+ } else {
+ return metadataBuilder_.getMessage();
+ }
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public Builder setMetadata(Metadata value) {
+ if (metadataBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ metadata_ = value;
+ onChanged();
+ } else {
+ metadataBuilder_.setMessage(value);
+ }
+
+ return this;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public Builder setMetadata(
+ Metadata.Builder builderForValue) {
+ if (metadataBuilder_ == null) {
+ metadata_ = builderForValue.build();
+ onChanged();
+ } else {
+ metadataBuilder_.setMessage(builderForValue.build());
+ }
+
+ return this;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public Builder mergeMetadata(Metadata value) {
+ if (metadataBuilder_ == null) {
+ if (metadata_ != null) {
+ metadata_ =
+ Metadata.newBuilder(metadata_).mergeFrom(value).buildPartial();
+ } else {
+ metadata_ = value;
+ }
+ onChanged();
+ } else {
+ metadataBuilder_.mergeFrom(value);
+ }
+
+ return this;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public Builder clearMetadata() {
+ if (metadataBuilder_ == null) {
+ metadata_ = null;
+ onChanged();
+ } else {
+ metadata_ = null;
+ metadataBuilder_ = null;
+ }
+
+ return this;
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public Metadata.Builder getMetadataBuilder() {
+
+ onChanged();
+ return getMetadataFieldBuilder().getBuilder();
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ public MetadataOrBuilder getMetadataOrBuilder() {
+ if (metadataBuilder_ != null) {
+ return metadataBuilder_.getMessageOrBuilder();
+ } else {
+ return metadata_ == null ?
+ Metadata.getDefaultInstance() : metadata_;
+ }
+ }
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ Metadata, Metadata.Builder, MetadataOrBuilder>
+ getMetadataFieldBuilder() {
+ if (metadataBuilder_ == null) {
+ metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
+ Metadata, Metadata.Builder, MetadataOrBuilder>(
+ getMetadata(),
+ getParentForChildren(),
+ isClean());
+ metadata_ = null;
+ }
+ return metadataBuilder_;
+ }
+
+ private com.google.protobuf.Any body_;
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> bodyBuilder_;
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return Whether the body field is set.
+ */
+ public boolean hasBody() {
+ return bodyBuilder_ != null || body_ != null;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return The body.
+ */
+ public com.google.protobuf.Any getBody() {
+ if (bodyBuilder_ == null) {
+ return body_ == null ? com.google.protobuf.Any.getDefaultInstance() : body_;
+ } else {
+ return bodyBuilder_.getMessage();
+ }
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public Builder setBody(com.google.protobuf.Any value) {
+ if (bodyBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ body_ = value;
+ onChanged();
+ } else {
+ bodyBuilder_.setMessage(value);
+ }
+
+ return this;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public Builder setBody(
+ com.google.protobuf.Any.Builder builderForValue) {
+ if (bodyBuilder_ == null) {
+ body_ = builderForValue.build();
+ onChanged();
+ } else {
+ bodyBuilder_.setMessage(builderForValue.build());
+ }
+
+ return this;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public Builder mergeBody(com.google.protobuf.Any value) {
+ if (bodyBuilder_ == null) {
+ if (body_ != null) {
+ body_ =
+ com.google.protobuf.Any.newBuilder(body_).mergeFrom(value).buildPartial();
+ } else {
+ body_ = value;
+ }
+ onChanged();
+ } else {
+ bodyBuilder_.mergeFrom(value);
+ }
+
+ return this;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public Builder clearBody() {
+ if (bodyBuilder_ == null) {
+ body_ = null;
+ onChanged();
+ } else {
+ body_ = null;
+ bodyBuilder_ = null;
+ }
+
+ return this;
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public com.google.protobuf.Any.Builder getBodyBuilder() {
+
+ onChanged();
+ return getBodyFieldBuilder().getBuilder();
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ public com.google.protobuf.AnyOrBuilder getBodyOrBuilder() {
+ if (bodyBuilder_ != null) {
+ return bodyBuilder_.getMessageOrBuilder();
+ } else {
+ return body_ == null ?
+ com.google.protobuf.Any.getDefaultInstance() : body_;
+ }
+ }
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ private com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>
+ getBodyFieldBuilder() {
+ if (bodyBuilder_ == null) {
+ bodyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
+ com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>(
+ getBody(),
+ getParentForChildren(),
+ isClean());
+ body_ = null;
+ }
+ return bodyBuilder_;
+ }
+
+ @Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+ // @@protoc_insertion_point(builder_scope:Payload)
+ }
+
+ // @@protoc_insertion_point(class_scope:Payload)
+ private static final Payload DEFAULT_INSTANCE;
+
+ static {
+ DEFAULT_INSTANCE = new Payload();
+ }
+
+ public static Payload getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @Override
+ public Payload parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new Payload(input, extensionRegistry);
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public Payload getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+}
+
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/PayloadOrBuilder.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/PayloadOrBuilder.java
new file mode 100644
index 0000000000..a50a340e1b
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/adminserver/PayloadOrBuilder.java
@@ -0,0 +1,62 @@
+/*
+ * 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.common.protocol.grpc.adminserver;// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: event_mesh_admin_service.proto
+
+public interface PayloadOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:Payload)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *