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/build.gradle b/build.gradle
index 3fc27890d1..c094f62551 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.17.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.17.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/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..3d702e579e
--- /dev/null
+++ b/eventmesh-admin-server/conf/application.yaml
@@ -0,0 +1,42 @@
+#
+# 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
+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
+ R2:
+ - http://localhost:8082
+ 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..07a6a212e7
--- /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.server.retry.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..6e28daca8a
--- /dev/null
+++ b/eventmesh-admin-server/conf/eventmesh.sql
@@ -0,0 +1,152 @@
+-- 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;
+
+/*!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..6341a0e629
--- /dev/null
+++ b/eventmesh-admin-server/conf/log4j2.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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/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..612d398078
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.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;
+
+import java.util.List;
+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..b179a790c5
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
@@ -0,0 +1,33 @@
+/*
+ * 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.constatns.AdminServerConstants;
+import org.apache.eventmesh.common.config.ConfigService;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = "org.apache.eventmesh.admin.server")
+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);
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constatns/AdminServerConstants.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constatns/AdminServerConstants.java
new file mode 100644
index 0000000000..44afaca1c2
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constatns/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.constatns;
+
+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..2454e9f02c
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
@@ -0,0 +1,73 @@
+/*
+ * 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.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.ReportVerifyRequest;
+import org.apache.eventmesh.common.remote.response.CreateTaskResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.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;
+
+ @RequestMapping(value = "/createTask", method = RequestMethod.POST)
+ public ResponseEntity 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);
+ return ResponseEntity.ok(JsonUtils.toJSONString(Response.success(createTaskResponse)));
+ }
+
+
+ @RequestMapping(value = "/reportVerify", method = RequestMethod.POST)
+ public ResponseEntity 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);
+ if (result) {
+ return ResponseEntity.ok("report verify success.request:" + JsonUtils.toJSONString(request));
+ } else {
+ return ResponseEntity.internalServerError().body("report verify success.request:" + JsonUtils.toJSONString(request));
+ }
+ }
+
+ public boolean deleteTask(Long id) {
+ return false;
+ }
+
+
+}
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/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/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/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/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/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/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..dc35cfe071
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/EventMeshTaskInfoService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.web.db.service;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * event_mesh_task_info
+ */
+public interface EventMeshTaskInfoService extends IService {
+
+}
diff --git a/eventmesh-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/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..9568b63671
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/db/service/impl/EventMeshTaskInfoServiceImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.web.db.service.impl;
+
+import org.apache.eventmesh.admin.server.web.db.entity.EventMeshTaskInfo;
+import org.apache.eventmesh.admin.server.web.db.mapper.EventMeshTaskInfoMapper;
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * event_mesh_task_info
+ */
+@Service
+public class EventMeshTaskInfoServiceImpl extends ServiceImpl
+ implements EventMeshTaskInfoService {
+
+}
+
+
+
+
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/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..ea836ce7aa
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportJobRequestHandler.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.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.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.request.ReportJobRequest;
+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 ReportJobRequestHandler extends BaseRequestHandler {
+
+ @Autowired
+ JobInfoBizService jobInfoBizService;
+
+ @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 result = jobInfoBizService.updateJobState(jobInfo.getJobID(), request.getState());
+ if (result) {
+ return SimpleResponse.success();
+ } else {
+ return SimpleResponse.fail(ErrorCode.INTERNAL_ERR, "update job failed.");
+ }
+ }
+}
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..9844f47c6a
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/handler/impl/ReportVerifyHandler.java
@@ -0,0 +1,92 @@
+/*
+ * 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.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 = properties.getAdminServerList().get(fromRegion);
+ 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/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..86f5342f35
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/pojo/TaskDetail.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+/**
+ * Description:
+ */
+public class TaskDetail {
+}
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..76df629e69
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/job/JobInfoBizService.java
@@ -0,0 +1,273 @@
+/*
+ * 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.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 != jobs.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;
+ }
+ EventMeshJobInfo job = jobInfoService.getOne(Wrappers.query().eq("jobID", jobID));
+ return job;
+ }
+
+ 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;
+ }
+ EventMeshRuntimeHeartbeat heartbeat = heartbeatService.getOne(Wrappers.query().eq("jobID", jobID));
+ if (heartbeat == null) {
+ continue;
+ }
+ // if last heart beat update time have delay three period.print job heart beat delay warn
+ long currentTimeStamp = System.currentTimeMillis();
+ if (currentTimeStamp - heartbeat.getUpdateTime().getTime() > 3 * heatBeatPeriod) {
+ log.warn("current job heart heart has delay.jobID:{},currentTimeStamp:{},last update time:{}", jobID, currentTimeStamp,
+ heartbeat.getUpdateTime());
+ }
+ }
+ }
+
+}
+
+
+
+
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/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..c40fc9e7e5
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/PositionBizService.java
@@ -0,0 +1,83 @@
+/*
+ * 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.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);
+ }
+}
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..e09c1a3837
--- /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 {
+
+ 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..b8d536f388
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/HttpPositionHandler.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.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.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;
+ }
+}
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..352ba57e96
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/position/impl/MysqlPositionHandler.java
@@ -0,0 +1,192 @@
+/*
+ * 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.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.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.ReportPositionRequest;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+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.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 final long retryPeriod = Duration.ofMillis(500).toNanos();
+
+ @Autowired
+ EventMeshMysqlPositionService positionService;
+
+ @Autowired
+ EventMeshPositionReporterHistoryService historyService;
+
+ @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;
+ }
+}
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..7bc16ba4ac
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/service/task/TaskBizService.java
@@ -0,0 +1,175 @@
+/*
+ * 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.Response;
+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.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.response.CreateTaskResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+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;
+
+@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 = properties.getAdminServerList().get(targetRegion);
+ 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)) {
+ Response response = JsonUtils.parseObject(remoteResponse, Response.class);
+ CreateTaskResponse remoteCreateTaskResponse = JsonUtils.convertValue(response.getData(), CreateTaskResponse.class);
+ jobDetailList.addAll(remoteCreateTaskResponse.getJobIdList());
+ }
+ createTaskResponse.setJobIdList(jobDetailList);
+ return createTaskResponse;
+ }
+}
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/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 84%
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..ccebe5a998 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;
+ private int maxConnectionPoolSize = 5;
// retry config
private HttpRetryConfig retryConfig = new HttpRetryConfig();
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..282f883332
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/http/SourceConnectorConfig.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.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;
+
+ // protocol, default Common
+ private String protocol = "Common";
+
+ // extra config, e.g. GitHub secret
+ private Map extraConfig = new HashMap<>();
+
+ // data consistency enabled, default true
+ private boolean dataConsistencyEnabled = false;
+}
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..f1d78a65dc
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSinkFullConfig.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 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;
+}
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..32112a769b
--- /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;
+
+ private boolean isGTIDMode = true;
+
+ 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/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..15398b303a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/CanalSourceFullConfig.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.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;
+ private int flushSize;
+}
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..94fe007b5f
--- /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;
+
+ private String desc;
+
+ private boolean ddlSync = true;
+
+ private boolean filterTableError = false;
+
+ private Long slaveId;
+
+ private Short clientId;
+
+ 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;
+
+ // sync consistency
+ private SyncConsistency syncConsistency;
+
+ // ================================= system parameter
+ // ================================
+
+ // Column name of the bidirectional synchronization mark
+ private String needSyncMarkTableColumnName = "needSync";
+
+ // Column value of the bidirectional synchronization mark
+ private String needSyncMarkTableColumnValue = "needSync";
+
+ 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..08f88e1d24
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/JobRdbFullPosition.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.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 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-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java
similarity index 78%
rename from eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java
index 873a0d1922..ab3ed336f8 100644
--- a/eventmesh-connectors/eventmesh-connector-http/src/main/java/org/apache/eventmesh/connector/http/source/config/SourceConnectorConfig.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/connector/rdb/canal/RdbDBDefinition.java
@@ -15,18 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.connector.http.source.config;
+package org.apache.eventmesh.common.config.connector.rdb.canal;
+
+import java.util.Set;
import lombok.Data;
+/**
+ * Description: as class name
+ */
@Data
-public class SourceConnectorConfig {
-
- private String connectorName;
-
- private String path;
-
- private int port;
-
- private int idleTimeout;
+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..cdd3652378
--- /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.Map;
+import java.util.Set;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description:
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MySQLTableDef extends RdbTableDefinition {
+ private Set 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 {
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return Whether the metadata field is set.
+ */
+ boolean hasMetadata();
+
+ /**
+ * .Metadata metadata = 2;
+ *
+ * @return The metadata.
+ */
+ Metadata getMetadata();
+
+ /**
+ * .Metadata metadata = 2;
+ */
+ MetadataOrBuilder getMetadataOrBuilder();
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return Whether the body field is set.
+ */
+ boolean hasBody();
+
+ /**
+ * .google.protobuf.Any body = 3;
+ *
+ * @return The body.
+ */
+ com.google.protobuf.Any getBody();
+
+ /**
+ * .google.protobuf.Any body = 3;
+ */
+ com.google.protobuf.AnyOrBuilder getBodyOrBuilder();
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/proto/event_mesh_admin_service.proto b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/proto/event_mesh_admin_service.proto
new file mode 100644
index 0000000000..fa7095840f
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/proto/event_mesh_admin_service.proto
@@ -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.
+ */
+
+syntax="proto3";
+
+import "google/protobuf/any.proto";
+
+option java_multiple_files=true;
+
+message Metadata {
+ string type = 3;
+ map headers = 7;
+}
+
+
+message Payload {
+ Metadata metadata = 2;
+ bytes body = 3;
+}
+
+service AdminService {
+ rpc invokeBiStream(stream Payload) returns (stream Payload){}
+ rpc invoke(Payload) returns (Payload){}
+}
+
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.java
new file mode 100644
index 0000000000..da9daffe9c
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/JobState.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.common.remote;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.ToString;
+
+@ToString
+public enum JobState {
+ INIT, RUNNING, COMPLETE, DELETE, FAIL;
+ private static final JobState[] STATES_NUM_INDEX = JobState.values();
+ private static final Map STATES_NAME_INDEX = new HashMap<>();
+
+ static {
+ for (JobState jobState : STATES_NUM_INDEX) {
+ STATES_NAME_INDEX.put(jobState.name(), jobState);
+ }
+ }
+
+ public static JobState fromIndex(Integer index) {
+ if (index == null || index < 0 || index >= STATES_NUM_INDEX.length) {
+ return null;
+ }
+
+ return STATES_NUM_INDEX[index];
+ }
+
+ public static JobState fromIndex(String index) {
+ if (index == null || index.isEmpty()) {
+ return null;
+ }
+
+ return STATES_NAME_INDEX.get(index);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TaskState.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TaskState.java
new file mode 100644
index 0000000000..606339c443
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TaskState.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.common.remote;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.ToString;
+
+@ToString
+public enum TaskState {
+ INIT, STARTED, RUNNING, PAUSE, COMPLETE, DELETE, FAIL;
+ private static final TaskState[] STATES_NUM_INDEX = TaskState.values();
+ private static final Map STATES_NAME_INDEX = new HashMap<>();
+ static {
+ for (TaskState jobState : STATES_NUM_INDEX) {
+ STATES_NAME_INDEX.put(jobState.name(), jobState);
+ }
+ }
+
+ public static TaskState fromIndex(Integer index) {
+ if (index == null || index < 0 || index >= STATES_NUM_INDEX.length) {
+ return null;
+ }
+
+ return STATES_NUM_INDEX[index];
+ }
+
+ public static TaskState fromIndex(String index) {
+ if (index == null || index.isEmpty()) {
+ return null;
+ }
+
+ return STATES_NAME_INDEX.get(index);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TransportType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TransportType.java
new file mode 100644
index 0000000000..6b43598398
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/TransportType.java
@@ -0,0 +1,73 @@
+/*
+ * 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.remote;
+
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.Getter;
+
+@Getter
+public enum TransportType {
+ MYSQL_MYSQL(DataSourceType.MYSQL, DataSourceType.MYSQL),
+ REDIS_REDIS(DataSourceType.REDIS, DataSourceType.REDIS),
+ ROCKETMQ_ROCKETMQ(DataSourceType.ROCKETMQ, DataSourceType.ROCKETMQ),
+ MYSQL_HTTP(DataSourceType.MYSQL, DataSourceType.HTTP),
+ ROCKETMQ_HTTP(DataSourceType.ROCKETMQ, DataSourceType.HTTP),
+ HTTP_MYSQL(DataSourceType.HTTP, DataSourceType.MYSQL),
+ HTTP_REDIS(DataSourceType.HTTP, DataSourceType.REDIS),
+ HTTP_ROCKETMQ(DataSourceType.HTTP, DataSourceType.ROCKETMQ),
+ REDIS_MQ(DataSourceType.REDIS, DataSourceType.ROCKETMQ),
+ HTTP_HTTP(DataSourceType.HTTP, DataSourceType.HTTP),
+ ;
+ private static final Map INDEX_TYPES = new HashMap<>();
+ private static final TransportType[] TYPES = TransportType.values();
+ private static final String SEPARATOR = "@";
+
+ static {
+ for (TransportType type : TYPES) {
+ INDEX_TYPES.put(type.name(), type);
+ }
+ }
+
+ private final DataSourceType src;
+
+ private final DataSourceType dst;
+
+ TransportType(DataSourceType src, DataSourceType dst) {
+ this.src = src;
+ this.dst = dst;
+ }
+
+
+ public static TransportType getTransportType(String index) {
+ if (index == null || index.isEmpty()) {
+ return null;
+ }
+ return INDEX_TYPES.get(index);
+ }
+
+ public static TransportType getTransportType(Integer index) {
+ if (index == null || index < 0 || index >= TYPES.length) {
+ return null;
+ }
+ return TYPES[index];
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSource.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSource.java
new file mode 100644
index 0000000000..afda984805
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSource.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remote.datasource;
+
+import org.apache.eventmesh.common.config.connector.Config;
+import org.apache.eventmesh.common.config.connector.rdb.canal.CanalSinkConfig;
+import org.apache.eventmesh.common.config.connector.rdb.canal.CanalSourceConfig;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import lombok.Data;
+
+@Data
+public class DataSource {
+
+ private DataSourceType type;
+
+ private String desc;
+ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
+ @JsonSubTypes({
+ @JsonSubTypes.Type(value = CanalSourceConfig.class, name = "CanalSourceConfig"),
+ @JsonSubTypes.Type(value = CanalSinkConfig.class, name = "CanalSinkConfig")
+ })
+ private Config conf;
+
+ private Class extends Config> confClazz;
+
+ private String region;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceClassify.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceClassify.java
new file mode 100644
index 0000000000..8cb01c9204
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceClassify.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.common.remote.datasource;
+
+public enum DataSourceClassify {
+ // relationship db
+ RDB,
+ MQ,
+ CACHE,
+ TUNNEL;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceConf.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceConf.java
new file mode 100644
index 0000000000..9701a9fa11
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceConf.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.remote.datasource;
+
+
+public abstract class DataSourceConf {
+ public abstract Class extends DataSourceConf> getConfClass();
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceDriverType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceDriverType.java
new file mode 100644
index 0000000000..4429bee5a9
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceDriverType.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.common.remote.datasource;
+
+public enum DataSourceDriverType {
+ MYSQL,
+ REDIS,
+ ROCKETMQ,
+ HTTP;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceType.java
new file mode 100644
index 0000000000..8c40971e7b
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/datasource/DataSourceType.java
@@ -0,0 +1,73 @@
+/*
+ * 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.remote.datasource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.Getter;
+import lombok.ToString;
+
+@Getter
+@ToString
+public enum DataSourceType {
+ MYSQL("MySQL", DataSourceDriverType.MYSQL, DataSourceClassify.RDB),
+ REDIS("Redis", DataSourceDriverType.REDIS, DataSourceClassify.CACHE),
+ ROCKETMQ("RocketMQ", DataSourceDriverType.ROCKETMQ, DataSourceClassify.MQ),
+ HTTP("HTTP", DataSourceDriverType.HTTP, DataSourceClassify.TUNNEL);
+ private static final Map INDEX_TYPES = new HashMap<>();
+ private static final DataSourceType[] TYPES = DataSourceType.values();
+ static {
+ for (DataSourceType type : TYPES) {
+ INDEX_TYPES.put(type.name(), type);
+ }
+ }
+
+ private final String name;
+ private final DataSourceDriverType driverType;
+ private final DataSourceClassify classify;
+
+ DataSourceType(String name, DataSourceDriverType driverType, DataSourceClassify classify) {
+ this.name = name;
+ this.driverType = driverType;
+ this.classify = classify;
+ }
+
+ public static DataSourceType getDataSourceType(String index) {
+ if (index == null || index.isEmpty()) {
+ return null;
+ }
+ return INDEX_TYPES.get(index);
+ }
+
+ public static DataSourceType getDataSourceType(Integer index) {
+ if (index == null || index < 0 || index >= TYPES.length) {
+ return null;
+ }
+ return TYPES[index];
+ }
+
+ public static DataSourceType fromString(String type) {
+ for (DataSourceType dataSourceType : DataSourceType.values()) {
+ if (dataSourceType.name().equalsIgnoreCase(type)) {
+ return dataSourceType;
+ }
+ }
+ throw new IllegalArgumentException("No enum constant for type: " + type);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/ErrorCode.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/ErrorCode.java
new file mode 100644
index 0000000000..f24971acc7
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/ErrorCode.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.remote.exception;
+
+public class ErrorCode {
+
+ public static final int SUCCESS = 0;
+ public static final int BAD_REQUEST = 4001;
+ public static final int BAD_DB_DATA = 4002;
+
+ public static final int INTERNAL_ERR = 5000;
+ public static final int STARTUP_CONFIG_MISS = 5001;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/PayloadFormatException.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/PayloadFormatException.java
new file mode 100644
index 0000000000..affa6b8bbf
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/PayloadFormatException.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.common.remote.exception;
+
+public class PayloadFormatException extends RemoteRuntimeException {
+
+ public PayloadFormatException(int code, String desc) {
+ super(code, desc);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/RemoteRuntimeException.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/RemoteRuntimeException.java
new file mode 100644
index 0000000000..708a558d37
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/exception/RemoteRuntimeException.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.remote.exception;
+
+public class RemoteRuntimeException extends RuntimeException {
+
+ protected final int code;
+ protected final String message;
+
+ public RemoteRuntimeException(int code, String message) {
+ this.code = code;
+ this.message = message;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobConnectorConfig.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobConnectorConfig.java
new file mode 100644
index 0000000000..14e8178cf3
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobConnectorConfig.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.remote.job;
+
+import java.util.Map;
+
+import lombok.Data;
+
+/**
+ * Description:
+ */
+@Data
+public class JobConnectorConfig {
+ private Map sourceConnectorConfig;
+
+ private String sourceConnectorDesc;
+
+ private Map sinkConnectorConfig;
+
+ private String sinkConnectorDesc;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobType.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobType.java
new file mode 100644
index 0000000000..83d2f56964
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/JobType.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.common.remote.job;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum JobType {
+ FULL,
+ INCREASE,
+ CHECK;
+
+ private static final JobType[] STATES_NUM_INDEX = JobType.values();
+ private static final Map STATES_NAME_INDEX = new HashMap<>();
+ static {
+ for (JobType jobType : STATES_NUM_INDEX) {
+ STATES_NAME_INDEX.put(jobType.name(), jobType);
+ }
+ }
+
+ public static JobType fromIndex(Integer index) {
+ if (index == null || index < 0 || index > STATES_NUM_INDEX.length) {
+ return null;
+ }
+
+ return STATES_NUM_INDEX[index];
+ }
+
+ public static JobType fromIndex(String index) {
+ if (index == null || index.isEmpty()) {
+ return null;
+ }
+
+ return STATES_NAME_INDEX.get(index);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncConsistency.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncConsistency.java
new file mode 100644
index 0000000000..a5aec2aa38
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncConsistency.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.common.remote.job;
+
+public enum SyncConsistency {
+ /**
+ * based with media
+ */
+ MEDIA("M"),
+ /**
+ * based with store
+ */
+ STORE("S"),
+ /**
+ * Based on the current change value, eventual consistency
+ */
+ BASE("B");
+
+ private String value;
+
+ SyncConsistency(String value) {
+ this.value = value;
+ }
+
+ public static SyncConsistency valuesOf(String value) {
+ SyncConsistency[] modes = values();
+ for (SyncConsistency mode : modes) {
+ if (mode.value.equalsIgnoreCase(value)) {
+ return mode;
+ }
+ }
+ return null;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public boolean isMedia() {
+ return this.equals(SyncConsistency.MEDIA);
+ }
+
+ public boolean isStore() {
+ return this.equals(SyncConsistency.STORE);
+ }
+
+ public boolean isBase() {
+ return this.equals(SyncConsistency.BASE);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncMode.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncMode.java
new file mode 100644
index 0000000000..0f2f9bdfcb
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/job/SyncMode.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.remote.job;
+
+public enum SyncMode {
+ /**
+ * row
+ */
+ ROW("R"),
+ /**
+ * field
+ */
+ FIELD("F");
+
+ private String value;
+
+ SyncMode(String value) {
+ this.value = value;
+ }
+
+ public static SyncMode valuesOf(String value) {
+ SyncMode[] modes = values();
+ for (SyncMode mode : modes) {
+ if (mode.value.equalsIgnoreCase(value)) {
+ return mode;
+ }
+ }
+ return null;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public boolean isRow() {
+ return this.equals(SyncMode.ROW);
+ }
+
+ public boolean isField() {
+ return this.equals(SyncMode.FIELD);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordOffset.java
new file mode 100644
index 0000000000..f78585ca15
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordOffset.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.common.remote.offset;
+
+public abstract class RecordOffset {
+
+ public abstract Class extends RecordOffset> getRecordOffsetClass();
+
+ public RecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPartition.java
new file mode 100644
index 0000000000..00e4c30e48
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPartition.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.common.remote.offset;
+
+public abstract class RecordPartition {
+
+ public abstract Class extends RecordPartition> getRecordPartitionClass();
+
+ public RecordPartition() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPosition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPosition.java
new file mode 100644
index 0000000000..5f45390b73
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/RecordPosition.java
@@ -0,0 +1,132 @@
+/*
+ * 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.remote.offset;
+
+import org.apache.eventmesh.common.remote.offset.S3.S3RecordOffset;
+import org.apache.eventmesh.common.remote.offset.S3.S3RecordPartition;
+import org.apache.eventmesh.common.remote.offset.canal.CanalFullRecordOffset;
+import org.apache.eventmesh.common.remote.offset.canal.CanalFullRecordPartition;
+import org.apache.eventmesh.common.remote.offset.canal.CanalRecordOffset;
+import org.apache.eventmesh.common.remote.offset.canal.CanalRecordPartition;
+import org.apache.eventmesh.common.remote.offset.file.FileRecordOffset;
+import org.apache.eventmesh.common.remote.offset.file.FileRecordPartition;
+import org.apache.eventmesh.common.remote.offset.kafka.KafkaRecordOffset;
+import org.apache.eventmesh.common.remote.offset.kafka.KafkaRecordPartition;
+import org.apache.eventmesh.common.remote.offset.pulsar.PulsarRecordOffset;
+import org.apache.eventmesh.common.remote.offset.pulsar.PulsarRecordPartition;
+import org.apache.eventmesh.common.remote.offset.rocketmq.RocketMQRecordOffset;
+import org.apache.eventmesh.common.remote.offset.rocketmq.RocketMQRecordPartition;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+public class RecordPosition {
+
+ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
+ @JsonSubTypes({
+ @JsonSubTypes.Type(value = CanalRecordPartition.class, name = "CanalRecordPartition"),
+ @JsonSubTypes.Type(value = CanalFullRecordPartition.class, name = "CanalFullRecordPartition"),
+ @JsonSubTypes.Type(value = FileRecordPartition.class, name = "FileRecordPartition"),
+ @JsonSubTypes.Type(value = S3RecordPartition.class, name = "S3RecordPartition"),
+ @JsonSubTypes.Type(value = KafkaRecordPartition.class, name = "KafkaRecordPartition"),
+ @JsonSubTypes.Type(value = PulsarRecordPartition.class, name = "PulsarRecordPartition"),
+ @JsonSubTypes.Type(value = RocketMQRecordPartition.class, name = "RocketMQRecordPartition"),
+ })
+ private RecordPartition recordPartition;
+
+ private Class extends RecordPartition> recordPartitionClazz;
+
+ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
+ @JsonSubTypes({
+ @JsonSubTypes.Type(value = CanalRecordOffset.class, name = "CanalRecordOffset"),
+ @JsonSubTypes.Type(value = CanalFullRecordOffset.class, name = "CanalFullRecordOffset"),
+ @JsonSubTypes.Type(value = FileRecordOffset.class, name = "FileRecordOffset"),
+ @JsonSubTypes.Type(value = S3RecordOffset.class, name = "S3RecordOffset"),
+ @JsonSubTypes.Type(value = KafkaRecordOffset.class, name = "KafkaRecordOffset"),
+ @JsonSubTypes.Type(value = PulsarRecordOffset.class, name = "PulsarRecordOffset"),
+ @JsonSubTypes.Type(value = RocketMQRecordOffset.class, name = "RocketMQRecordOffset"),
+ })
+ private RecordOffset recordOffset;
+
+ private Class extends RecordOffset> recordOffsetClazz;
+
+ public RecordPosition() {
+
+ }
+
+ public RecordPosition(
+ RecordPartition recordPartition, RecordOffset recordOffset) {
+ this.recordPartition = recordPartition;
+ this.recordOffset = recordOffset;
+ this.recordPartitionClazz = recordPartition.getRecordPartitionClass();
+ this.recordOffsetClazz = recordOffset.getRecordOffsetClass();
+ }
+
+ public RecordPartition getRecordPartition() {
+ return recordPartition;
+ }
+
+ public void setRecordPartition(RecordPartition recordPartition) {
+ this.recordPartition = recordPartition;
+ if (recordPartition == null) {
+ this.recordPartitionClazz = null;
+ return;
+ }
+ this.recordPartitionClazz = recordPartition.getRecordPartitionClass();
+ }
+
+ public RecordOffset getRecordOffset() {
+ return recordOffset;
+ }
+
+ public void setRecordOffset(RecordOffset recordOffset) {
+ this.recordOffset = recordOffset;
+ if (recordOffset == null) {
+ this.recordOffsetClazz = null;
+ return;
+ }
+ this.recordOffsetClazz = recordOffset.getRecordOffsetClass();
+ }
+
+ public Class extends RecordPartition> getRecordPartitionClazz() {
+ return recordPartitionClazz;
+ }
+
+ public Class extends RecordOffset> getRecordOffsetClazz() {
+ return recordOffsetClazz;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof RecordPosition)) {
+ return false;
+ }
+ RecordPosition position = (RecordPosition) o;
+ return recordPartition.equals(position.recordPartition) && recordOffset.equals(position.recordOffset);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(recordPartition, recordOffset);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordOffset.java
new file mode 100644
index 0000000000..9f38e4b2c6
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.S3;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class S3RecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return S3RecordOffset.class;
+ }
+
+ public S3RecordOffset() {
+
+ }
+}
diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordPartition.java
similarity index 58%
rename from eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordPartition.java
index 959a6b9b3c..3e42a4d093 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPartition.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/S3/S3RecordPartition.java
@@ -15,32 +15,33 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.offsetmgmt.api.data;
+package org.apache.eventmesh.common.remote.offset.S3;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Objects;
-public class RecordPartition {
+import lombok.Data;
+import lombok.ToString;
- /**
- * if pull message from mq key=topic,
- * value=topicName key=brokerName,
- * value=brokerName key=queueId,
- * value=queueId
- */
- private Map partition = new HashMap<>();
- public RecordPartition() {
+@Data
+@ToString
+public class S3RecordPartition extends RecordPartition {
- }
+ private String region;
+
+ private String bucket;
- public RecordPartition(Map partition) {
- this.partition = partition;
+ private String fileName;
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return S3RecordPartition.class;
}
- public Map getPartition() {
- return partition;
+ public S3RecordPartition() {
+ super();
}
@Override
@@ -48,15 +49,15 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RecordPartition)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
- RecordPartition partition1 = (RecordPartition) o;
- return Objects.equals(partition, partition1.partition);
+ S3RecordPartition that = (S3RecordPartition) o;
+ return Objects.equals(fileName, that.fileName);
}
@Override
public int hashCode() {
- return Objects.hash(partition);
+ return Objects.hash(fileName);
}
}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordOffset.java
new file mode 100644
index 0000000000..a0a077b7f5
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordOffset.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.remote.offset.canal;
+
+import org.apache.eventmesh.common.config.connector.rdb.canal.JobRdbFullPosition;
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class CanalFullRecordOffset extends RecordOffset {
+ private JobRdbFullPosition position;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return CanalFullRecordOffset.class;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordPartition.java
new file mode 100644
index 0000000000..73626fa78f
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalFullRecordPartition.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.remote.offset.canal;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+
+@Data
+@ToString
+@EqualsAndHashCode(callSuper = true)
+public class CanalFullRecordPartition extends RecordPartition {
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return CanalFullRecordPartition.class;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordOffset.java
new file mode 100644
index 0000000000..d0f2053f4d
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordOffset.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remote.offset.canal;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class CanalRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ // mysql instance gtid range
+ private String gtid;
+
+ private String currentGtid;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return CanalRecordOffset.class;
+ }
+
+ public CanalRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordPartition.java
new file mode 100644
index 0000000000..ded82306e3
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/canal/CanalRecordPartition.java
@@ -0,0 +1,63 @@
+/*
+ * 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.remote.offset.canal;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import java.util.Objects;
+
+import lombok.Data;
+import lombok.ToString;
+
+
+@Data
+@ToString
+public class CanalRecordPartition extends RecordPartition {
+
+ private String serverUUID;
+
+ private String journalName;
+
+ private Long timeStamp;
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return CanalRecordPartition.class;
+ }
+
+ public CanalRecordPartition() {
+ super();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CanalRecordPartition that = (CanalRecordPartition) o;
+ return Objects.equals(journalName, that.journalName) && Objects.equals(timeStamp, that.timeStamp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(journalName, timeStamp);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordOffset.java
new file mode 100644
index 0000000000..cda293cb8c
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.file;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class FileRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return FileRecordOffset.class;
+ }
+
+ public FileRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordPartition.java
similarity index 61%
rename from eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordPartition.java
index fee70de27e..1a6dddad44 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordOffset.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/file/FileRecordPartition.java
@@ -15,30 +15,29 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.offsetmgmt.api.data;
+package org.apache.eventmesh.common.remote.offset.file;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Objects;
-public class RecordOffset {
+import lombok.Data;
+import lombok.ToString;
- /**
- * if pull message from mq key=queueOffset,
- * value=queueOffset value
- */
- private Map offset = new HashMap<>();
- public RecordOffset() {
+@Data
+@ToString
+public class FileRecordPartition extends RecordPartition {
- }
+ private String fileName;
- public RecordOffset(Map offset) {
- this.offset = offset;
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return FileRecordPartition.class;
}
- public Map getOffset() {
- return offset;
+ public FileRecordPartition() {
+ super();
}
@Override
@@ -46,16 +45,15 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RecordOffset)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
- RecordOffset offset1 = (RecordOffset) o;
- return Objects.equals(offset, offset1.offset);
+ FileRecordPartition that = (FileRecordPartition) o;
+ return Objects.equals(fileName, that.fileName);
}
@Override
public int hashCode() {
- return Objects.hash(offset);
+ return Objects.hash(fileName);
}
-
}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordOffset.java
new file mode 100644
index 0000000000..f5084c755f
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordOffset.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.remote.offset.http;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import java.util.Map;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class HttpRecordOffset extends RecordOffset {
+
+ private Map offsetMap;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return HttpRecordOffset.class;
+ }
+
+ public HttpRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordPartition.java
new file mode 100644
index 0000000000..453b3b501e
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/http/HttpRecordPartition.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.common.remote.offset.http;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class HttpRecordPartition extends RecordPartition {
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return HttpRecordPartition.class;
+ }
+
+ public HttpRecordPartition() {
+ super();
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordOffset.java
new file mode 100644
index 0000000000..a97a90e658
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.jdbc;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class JdbcRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return JdbcRecordOffset.class;
+ }
+
+ public JdbcRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordPartition.java
similarity index 57%
rename from eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java
rename to eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordPartition.java
index 0b836ab607..1eb6937a87 100644
--- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-api/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/api/data/RecordPosition.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/jdbc/JdbcRecordPartition.java
@@ -15,28 +15,29 @@
* limitations under the License.
*/
-package org.apache.eventmesh.openconnect.offsetmgmt.api.data;
+package org.apache.eventmesh.common.remote.offset.jdbc;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
import java.util.Objects;
-public class RecordPosition {
+import lombok.Data;
+import lombok.ToString;
- private final RecordPartition recordPartition;
- private final RecordOffset recordOffset;
+@Data
+@ToString
+public class JdbcRecordPartition extends RecordPartition {
- public RecordPosition(
- RecordPartition recordPartition, RecordOffset recordOffset) {
- this.recordPartition = recordPartition;
- this.recordOffset = recordOffset;
- }
+ private String fileName;
- public RecordPartition getPartition() {
- return recordPartition;
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return JdbcRecordPartition.class;
}
- public RecordOffset getOffset() {
- return recordOffset;
+ public JdbcRecordPartition() {
+ super();
}
@Override
@@ -44,15 +45,15 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof RecordPosition)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
- RecordPosition position = (RecordPosition) o;
- return recordPartition.equals(position.recordPartition) && recordOffset.equals(position.recordOffset);
+ JdbcRecordPartition that = (JdbcRecordPartition) o;
+ return Objects.equals(fileName, that.fileName);
}
@Override
public int hashCode() {
- return Objects.hash(recordPartition, recordOffset);
+ return Objects.hash(fileName);
}
}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordOffset.java
new file mode 100644
index 0000000000..134ef06fe4
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.kafka;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class KafkaRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return KafkaRecordOffset.class;
+ }
+
+ public KafkaRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordPartition.java
new file mode 100644
index 0000000000..77dec82267
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/kafka/KafkaRecordPartition.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.remote.offset.kafka;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import java.util.Objects;
+
+import lombok.Data;
+import lombok.ToString;
+
+
+@Data
+@ToString
+public class KafkaRecordPartition extends RecordPartition {
+
+ private String topic;
+
+ private Integer partition;
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return KafkaRecordPartition.class;
+ }
+
+ public KafkaRecordPartition() {
+ super();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ KafkaRecordPartition that = (KafkaRecordPartition) o;
+ return Objects.equals(topic, that.topic) && Objects.equals(partition, that.partition);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(topic, partition);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordOffset.java
new file mode 100644
index 0000000000..acb5b3ce02
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.prometheus;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class PrometheusRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return PrometheusRecordOffset.class;
+ }
+
+ public PrometheusRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordPartition.java
new file mode 100644
index 0000000000..74302504c2
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/prometheus/PrometheusRecordPartition.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.common.remote.offset.prometheus;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class PrometheusRecordPartition extends RecordPartition {
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return PrometheusRecordPartition.class;
+ }
+
+ public PrometheusRecordPartition() {
+ super();
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordOffset.java
new file mode 100644
index 0000000000..bbe3d43803
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordOffset.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remote.offset.pulsar;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class PulsarRecordOffset extends RecordOffset {
+
+ /**
+ * if pull message from mq
+ * key=queueOffset,
+ * value=queueOffset value
+ */
+ private Long queueOffset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return PulsarRecordOffset.class;
+ }
+
+ public PulsarRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordPartition.java
new file mode 100644
index 0000000000..0c152b50b3
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/pulsar/PulsarRecordPartition.java
@@ -0,0 +1,63 @@
+/*
+ * 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.remote.offset.pulsar;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import java.util.Objects;
+
+import lombok.Data;
+import lombok.ToString;
+
+
+@Data
+@ToString
+public class PulsarRecordPartition extends RecordPartition {
+
+ private String topic;
+
+ private Long queueId;
+
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return PulsarRecordPartition.class;
+ }
+
+ public PulsarRecordPartition() {
+ super();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ PulsarRecordPartition that = (PulsarRecordPartition) o;
+ return Objects.equals(topic, that.topic) && Objects.equals(queueId,
+ that.queueId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(topic, queueId);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordOffset.java
new file mode 100644
index 0000000000..56094c9e72
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordOffset.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remote.offset.rocketmq;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class RocketMQRecordOffset extends RecordOffset {
+
+ /**
+ * if pull message from mq
+ * key=queueOffset,
+ * value=queueOffset value
+ */
+ private Long queueOffset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return RocketMQRecordOffset.class;
+ }
+
+ public RocketMQRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordPartition.java
new file mode 100644
index 0000000000..0963af6f59
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/rocketmq/RocketMQRecordPartition.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.common.remote.offset.rocketmq;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import java.util.Objects;
+
+import lombok.Data;
+import lombok.ToString;
+
+
+@Data
+@ToString
+public class RocketMQRecordPartition extends RecordPartition {
+
+ /**
+ * key=topic,value=topicName key=brokerName,value=brokerName key=queueId,value=queueId
+ */
+
+ private String broker;
+
+ private String topic;
+
+ private String queueId;
+
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return RocketMQRecordPartition.class;
+ }
+
+ public RocketMQRecordPartition() {
+ super();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ RocketMQRecordPartition that = (RocketMQRecordPartition) o;
+ return Objects.equals(broker, that.broker) && Objects.equals(topic, that.topic) && Objects.equals(queueId,
+ that.queueId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(broker, topic, queueId);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordOffset.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordOffset.java
new file mode 100644
index 0000000000..d0916c5175
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordOffset.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remote.offset.spring;
+
+import org.apache.eventmesh.common.remote.offset.RecordOffset;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class SpringRecordOffset extends RecordOffset {
+
+ private Long offset;
+
+ @Override
+ public Class extends RecordOffset> getRecordOffsetClass() {
+ return SpringRecordOffset.class;
+ }
+
+ public SpringRecordOffset() {
+
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordPartition.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordPartition.java
new file mode 100644
index 0000000000..4b536da139
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/offset/spring/SpringRecordPartition.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.common.remote.offset.spring;
+
+import org.apache.eventmesh.common.remote.offset.RecordPartition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ToString
+public class SpringRecordPartition extends RecordPartition {
+
+ @Override
+ public Class extends RecordPartition> getRecordPartitionClass() {
+ return SpringRecordPartition.class;
+ }
+
+ public SpringRecordPartition() {
+ super();
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/IPayload.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/IPayload.java
new file mode 100644
index 0000000000..aca27ffc21
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/IPayload.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.common.remote.payload;
+
+/**
+ * IPayload
+ */
+public interface IPayload {
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadFactory.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadFactory.java
new file mode 100644
index 0000000000..74e4880443
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadFactory.java
@@ -0,0 +1,71 @@
+/*
+ * 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.remote.payload;
+
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class PayloadFactory {
+
+ private PayloadFactory() {
+ }
+
+ private static class PayloadFactoryHolder {
+
+ private static final PayloadFactory INSTANCE = new PayloadFactory();
+ }
+
+ public static PayloadFactory getInstance() {
+ return PayloadFactoryHolder.INSTANCE;
+ }
+
+ private final Map> registryPayload = new ConcurrentHashMap<>();
+
+ private boolean initialized = false;
+
+ public void init() {
+ scan();
+ }
+
+ private synchronized void scan() {
+ if (initialized) {
+ return;
+ }
+ ServiceLoader payloads = ServiceLoader.load(IPayload.class);
+ for (IPayload payload : payloads) {
+ register(payload.getClass().getSimpleName(), payload.getClass());
+ }
+ initialized = true;
+ }
+
+ public void register(String type, Class> clazz) {
+ if (Modifier.isAbstract(clazz.getModifiers())) {
+ return;
+ }
+ if (registryPayload.containsKey(type)) {
+ throw new RuntimeException(String.format("Fail to register, type:%s ,clazz:%s ", type, clazz.getName()));
+ }
+ registryPayload.put(type, clazz);
+ }
+
+ public Class> getClassByType(String type) {
+ return registryPayload.get(type);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadUtil.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadUtil.java
new file mode 100644
index 0000000000..6a21d5a825
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/payload/PayloadUtil.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remote.payload;
+
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Metadata;
+import org.apache.eventmesh.common.protocol.grpc.adminserver.Payload;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.exception.PayloadFormatException;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;
+import com.google.protobuf.Any;
+import com.google.protobuf.UnsafeByteOperations;
+
+public class PayloadUtil {
+
+ public static Payload from(IPayload payload) {
+ byte[] payloadBytes = JsonUtils.toJSONBytes(payload);
+ Metadata.Builder metadata = Metadata.newBuilder().setType(payload.getClass().getSimpleName());
+ return Payload.newBuilder().setMetadata(metadata).setBody(Any.newBuilder().setValue(UnsafeByteOperations.unsafeWrap(payloadBytes))).build();
+ }
+
+ public static IPayload parse(Payload payload) {
+ Class> targetClass = PayloadFactory.getInstance().getClassByType(payload.getMetadata().getType());
+ if (targetClass == null) {
+ throw new PayloadFormatException(ErrorCode.BAD_REQUEST,
+ "unknown payload type:" + payload.getMetadata().getType());
+ }
+ return (IPayload) JsonUtils.parseObject(new ByteBufferBackedInputStream(payload.getBody().getValue().asReadOnlyByteBuffer()), targetClass);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/BaseRemoteRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/BaseRemoteRequest.java
new file mode 100644
index 0000000000..b8c4c06207
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/BaseRemoteRequest.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.remote.request;
+
+import org.apache.eventmesh.common.remote.payload.IPayload;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.Getter;
+
+@Getter
+public abstract class BaseRemoteRequest implements IPayload {
+
+ private final Map header = new HashMap<>();
+
+ public void addHeader(String key, String value) {
+ if (key == null || value == null) {
+ return;
+ }
+ header.put(key, value);
+ }
+
+ public void addHeaders(Map map) {
+ if (map == null || map.isEmpty()) {
+ return;
+ }
+ map.forEach((k, v) -> {
+ if (k == null || v == null) {
+ return;
+ }
+ this.header.put(k, v);
+ });
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateOrUpdateDataSourceReq.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateOrUpdateDataSourceReq.java
new file mode 100644
index 0000000000..f78349703a
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateOrUpdateDataSourceReq.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.common.remote.request;
+
+import org.apache.eventmesh.common.config.connector.Config;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * create or update datasource with custom data source config
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CreateOrUpdateDataSourceReq extends BaseRemoteRequest {
+
+ private Integer id;
+ private DataSourceType type;
+ private String desc;
+ private Config config;
+ private String configClass;
+ private String region;
+ private String operator;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateTaskRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateTaskRequest.java
new file mode 100644
index 0000000000..b09a3e10ed
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/CreateTaskRequest.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.common.remote.request;
+
+import org.apache.eventmesh.common.remote.TransportType;
+import org.apache.eventmesh.common.remote.job.JobType;
+
+import java.util.List;
+import java.util.Map;
+
+import lombok.Data;
+
+/**
+ * Description: create task without task id, otherwise update task
+ */
+@Data
+public class CreateTaskRequest {
+
+ private String taskId;
+
+ // task name
+ private String taskName;
+
+ // task description
+ private String taskDesc;
+
+ // task owner or updater
+ private String uid;
+
+ private List jobs;
+
+ // task source region
+ private String sourceRegion;
+
+ // task target region
+ private String targetRegion;
+
+ // mark request send by other region admin, default is false
+ private boolean flag = false;
+
+ @Data
+ public static class JobDetail {
+
+ private String jobId;
+
+ private String jobDesc;
+
+ // full/increase/check
+ private JobType jobType;
+
+ private Map sourceDataSource;
+
+ private String sourceConnectorDesc;
+
+ private Map sinkDataSource;
+
+ private String sinkConnectorDesc;
+
+ private TransportType transportType;
+
+ // job request from region
+ private String fromRegion;
+
+ // job actually running region
+ private String runningRegion;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchJobRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchJobRequest.java
new file mode 100644
index 0000000000..2693a4a3aa
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchJobRequest.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.common.remote.request;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FetchJobRequest extends BaseRemoteRequest {
+ private String jobID;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchPositionRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchPositionRequest.java
new file mode 100644
index 0000000000..90563251ab
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/FetchPositionRequest.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.remote.request;
+
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FetchPositionRequest extends BaseRemoteRequest {
+
+ private String jobID;
+
+ private String address;
+
+ private RecordPosition recordPosition;
+
+ private DataSourceType dataSourceType;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportHeartBeatRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportHeartBeatRequest.java
new file mode 100644
index 0000000000..fb61ca3618
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportHeartBeatRequest.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.remote.request;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ReportHeartBeatRequest extends BaseRemoteRequest {
+
+ private String address;
+
+ private String reportedTimeStamp;
+
+ private String jobID;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportJobRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportJobRequest.java
new file mode 100644
index 0000000000..aec33e4616
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportJobRequest.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.remote.request;
+
+import org.apache.eventmesh.common.remote.JobState;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class ReportJobRequest extends BaseRemoteRequest {
+
+ private String jobID;
+
+ private JobState state;
+
+ private String address;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportPositionRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportPositionRequest.java
new file mode 100644
index 0000000000..42694d5675
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportPositionRequest.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.common.remote.request;
+
+import org.apache.eventmesh.common.remote.TaskState;
+import org.apache.eventmesh.common.remote.datasource.DataSourceType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class ReportPositionRequest extends BaseRemoteRequest {
+
+ private String jobID;
+
+ private List recordPositionList;
+
+ private TaskState state;
+
+ private String address;
+
+ private DataSourceType dataSourceType;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportVerifyRequest.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportVerifyRequest.java
new file mode 100644
index 0000000000..bd38881c3d
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/request/ReportVerifyRequest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.remote.request;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString
+public class ReportVerifyRequest extends BaseRemoteRequest {
+
+ private String taskID;
+
+ private String jobID;
+
+ private String recordID;
+
+ private String recordSig;
+
+ private String connectorName;
+
+ private String connectorStage;
+
+ private String position;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/BaseRemoteResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/BaseRemoteResponse.java
new file mode 100644
index 0000000000..3ea8401535
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/BaseRemoteResponse.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.common.remote.response;
+
+import org.apache.eventmesh.common.remote.payload.IPayload;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public abstract class BaseRemoteResponse implements IPayload {
+ @Setter
+ private boolean success = true;
+ @Setter
+ private int errorCode;
+ @Setter
+ private String desc;
+
+ private Map header = new HashMap<>();
+
+ public void addHeader(String key, String value) {
+ if (key == null || value == null) {
+ return;
+ }
+ header.put(key, value);
+ }
+
+ public void addHeaders(Map map) {
+ if (map == null || map.isEmpty()) {
+ return;
+ }
+ map.forEach((k, v) -> {
+ if (k == null || v == null) {
+ return;
+ }
+ this.header.put(k, v);
+ });
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/CreateTaskResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/CreateTaskResponse.java
new file mode 100644
index 0000000000..11678dfcf0
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/CreateTaskResponse.java
@@ -0,0 +1,33 @@
+/*
+ * 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.remote.response;
+
+import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
+
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class CreateTaskResponse extends BaseRemoteResponse {
+
+ private String taskId;
+
+ private List jobIdList;
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchJobResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchJobResponse.java
new file mode 100644
index 0000000000..95d2d157e0
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchJobResponse.java
@@ -0,0 +1,63 @@
+/*
+ * 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.remote.response;
+
+import org.apache.eventmesh.common.remote.TaskState;
+import org.apache.eventmesh.common.remote.TransportType;
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.job.JobConnectorConfig;
+import org.apache.eventmesh.common.remote.job.JobType;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FetchJobResponse extends BaseRemoteResponse {
+
+ private String id;
+
+ private TransportType transportType;
+
+ private JobConnectorConfig connectorConfig;
+
+ private List position;
+
+ private TaskState state;
+
+ private JobType type;
+
+ public static FetchJobResponse successResponse() {
+ FetchJobResponse response = new FetchJobResponse();
+ response.setSuccess(true);
+ response.setErrorCode(ErrorCode.SUCCESS);
+ return response;
+ }
+
+ public static FetchJobResponse failResponse(int code, String desc) {
+ FetchJobResponse response = new FetchJobResponse();
+ response.setSuccess(false);
+ response.setErrorCode(code);
+ response.setDesc(desc);
+ return response;
+ }
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchPositionResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchPositionResponse.java
new file mode 100644
index 0000000000..613623d654
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/FetchPositionResponse.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.common.remote.response;
+
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+import org.apache.eventmesh.common.remote.offset.RecordPosition;
+
+import java.util.List;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FetchPositionResponse extends BaseRemoteResponse {
+
+ private List recordPosition;
+
+ public static FetchPositionResponse successResponse() {
+ FetchPositionResponse response = new FetchPositionResponse();
+ response.setSuccess(true);
+ response.setErrorCode(ErrorCode.SUCCESS);
+ return response;
+ }
+
+ public static FetchPositionResponse successResponse(List recordPosition) {
+ FetchPositionResponse response = successResponse();
+ response.setRecordPosition(recordPosition);
+ return response;
+ }
+
+ public static FetchPositionResponse failResponse(int code, String desc) {
+ FetchPositionResponse response = new FetchPositionResponse();
+ response.setSuccess(false);
+ response.setErrorCode(code);
+ response.setDesc(desc);
+ return response;
+ }
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/SimpleResponse.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/SimpleResponse.java
new file mode 100644
index 0000000000..a4cdd52f99
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/remote/response/SimpleResponse.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.common.remote.response;
+
+import org.apache.eventmesh.common.remote.exception.ErrorCode;
+
+public class SimpleResponse extends BaseRemoteResponse {
+ /**
+ * just mean remote received or process success
+ */
+ public static SimpleResponse success() {
+ return new SimpleResponse();
+ }
+
+ public static SimpleResponse fail(int errorCode, String msg) {
+ SimpleResponse response = new SimpleResponse();
+ response.setErrorCode(errorCode);
+ response.setDesc(msg);
+ response.setSuccess(false);
+ return response;
+ }
+
+
+ /**
+ * build an error response.
+ *
+ * @param exception exception
+ * @return response
+ */
+ public static SimpleResponse fail(Throwable exception) {
+ return fail(ErrorCode.INTERNAL_ERR, exception.getMessage());
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/stubs/HeaderStub.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/stubs/HeaderStub.java
new file mode 100644
index 0000000000..1782d46dd6
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/stubs/HeaderStub.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.common.stubs;
+
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
+import org.apache.eventmesh.common.protocol.http.header.Header;
+import org.apache.eventmesh.common.utils.HttpConvertsUtils;
+
+import java.util.Map;
+
+public class HeaderStub extends Header {
+
+ public String code;
+ public String eventmeshenv;
+
+ @Override
+ public Map toMap() {
+ return new HttpConvertsUtils().httpMapConverts(this, new ProtocolKey(), new ProtocolKey.EventMeshInstanceKey());
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ConfigurationContextUtil.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ConfigurationContextUtil.java
index 8617888994..fede64d650 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ConfigurationContextUtil.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ConfigurationContextUtil.java
@@ -17,6 +17,7 @@
package org.apache.eventmesh.common.utils;
+import static org.apache.eventmesh.common.Constants.ADMIN;
import static org.apache.eventmesh.common.Constants.GRPC;
import static org.apache.eventmesh.common.Constants.HTTP;
import static org.apache.eventmesh.common.Constants.TCP;
@@ -36,7 +37,7 @@ public class ConfigurationContextUtil {
private static final ConcurrentHashMap CONFIGURATION_MAP = new ConcurrentHashMap<>();
- public static final List KEYS = Lists.newArrayList(HTTP, TCP, GRPC);
+ public static final List KEYS = Lists.newArrayList(HTTP, TCP, GRPC, ADMIN);
/**
* Save http, tcp, grpc configuration at startup for global use.
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java
index 998735181e..dcef8f8243 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java
@@ -37,6 +37,7 @@
import io.netty.channel.Channel;
+import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import inet.ipaddr.HostName;
@@ -46,7 +47,10 @@
@Slf4j
public class IPUtils {
- public static String getLocalAddress() {
+ @Getter
+ public static String localAddress = init();
+
+ private static String init() {
// if the progress works under docker environment
// return the host ip about this docker located from environment value
String dockerHostIp = System.getenv("docker_host_ip");
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java
index cf07bdfbe7..f2328541c4 100644
--- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java
@@ -24,6 +24,7 @@
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.Objects;
@@ -53,6 +54,14 @@ public class JsonUtils {
OBJECT_MAPPER.registerModule(new JavaTimeModule());
}
+ public static T convertValue(Object fromValue, Class toValueType) {
+ return OBJECT_MAPPER.convertValue(fromValue, toValueType);
+ }
+
+ public static T convertValue(Object fromValue, TypeReference toValueTypeRef) {
+ return OBJECT_MAPPER.convertValue(fromValue, toValueTypeRef);
+ }
+
public static T mapToObject(Map map, Class beanClass) {
if (map == null) {
return null;
@@ -60,7 +69,15 @@ public static T mapToObject(Map map, Class beanClass) {
Object obj = OBJECT_MAPPER.convertValue(map, beanClass);
return beanClass.cast(obj);
}
-
+
+ public static Map objectToMap(Object obj) {
+ if (obj == null) {
+ return null;
+ }
+ return OBJECT_MAPPER.convertValue(obj, new TypeReference>() {
+ });
+ }
+
/**
* Serialize object to json string.
*
@@ -108,6 +125,14 @@ public static T parseObject(String text, Class clazz) {
}
}
+ public static T parseObject(InputStream inputStream, Class clazz) {
+ try {
+ return OBJECT_MAPPER.readValue(inputStream, clazz);
+ } catch (IOException e) {
+ throw new JsonException("deserialize input stream to object error", e);
+ }
+ }
+
public static T parseObject(String text, Type type) {
if (StringUtils.isEmpty(text)) {
return null;
@@ -156,6 +181,21 @@ public static T parseTypeReferenceObject(String text, TypeReference typeR
}
}
+ public static T parseTypeReferenceObject(Object object, TypeReference typeReference) {
+ if (object == null) {
+ return null;
+ }
+ return convertValue(object, typeReference);
+ }
+
+ public static T parseTypeReferenceObject(byte[] text, TypeReference typeReference) {
+ try {
+ return OBJECT_MAPPER.readValue(text, typeReference);
+ } catch (IOException e) {
+ throw new JsonException("deserialize json string to typeReference error", e);
+ }
+ }
+
public static JsonNode getJsonNode(String text) {
if (StringUtils.isEmpty(text)) {
return null;
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/PagedList.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/PagedList.java
new file mode 100644
index 0000000000..322c585f04
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/PagedList.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.common.utils;
+
+import java.util.List;
+
+public class PagedList {
+ private int totalSize;
+ private int totalPage;
+ private int size;
+ private int page;
+
+ private List data;
+
+ public int getTotalSize() {
+ return totalSize;
+ }
+
+ public void setTotalSize(int totalSize) {
+ this.totalSize = totalSize;
+ }
+
+ public int getTotalPage() {
+ return totalPage;
+ }
+
+ public void setTotalPage(int totalPage) {
+ this.totalPage = totalPage;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
+
+ public int getPage() {
+ return page;
+ }
+
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+ public List getData() {
+ return data;
+ }
+
+ public void setData(List data) {
+ this.data = data;
+ }
+}
diff --git a/eventmesh-common/src/main/resources/META-INF/services/org.apache.eventmesh.common.remote.payload.IPayload b/eventmesh-common/src/main/resources/META-INF/services/org.apache.eventmesh.common.remote.payload.IPayload
new file mode 100644
index 0000000000..433cf57ed1
--- /dev/null
+++ b/eventmesh-common/src/main/resources/META-INF/services/org.apache.eventmesh.common.remote.payload.IPayload
@@ -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.
+
+org.apache.eventmesh.common.remote.request.FetchJobRequest
+org.apache.eventmesh.common.remote.response.FetchJobResponse
+org.apache.eventmesh.common.remote.request.ReportPositionRequest
+org.apache.eventmesh.common.remote.request.ReportJobRequest
+org.apache.eventmesh.common.remote.request.ReportVerifyRequest
+org.apache.eventmesh.common.remote.request.ReportHeartBeatRequest
+org.apache.eventmesh.common.remote.request.FetchPositionRequest
+org.apache.eventmesh.common.remote.response.FetchPositionResponse
\ No newline at end of file
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/loadbalance/RandomLoadBalanceSelectorTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/loadbalance/RandomLoadBalanceSelectorTest.java
index 434e19f3b2..8f5c457264 100644
--- a/eventmesh-common/src/test/java/org/apache/eventmesh/common/loadbalance/RandomLoadBalanceSelectorTest.java
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/loadbalance/RandomLoadBalanceSelectorTest.java
@@ -34,7 +34,7 @@ public class RandomLoadBalanceSelectorTest {
private RandomLoadBalanceSelector randomLoadBalanceSelector;
@BeforeEach
- public void befor() {
+ public void before() {
List address = new ArrayList<>();
address.add("A");
address.add("B");
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/HttpConvertsUtilsTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/HttpConvertsUtilsTest.java
new file mode 100644
index 0000000000..253b1de926
--- /dev/null
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/HttpConvertsUtilsTest.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.common.utils;
+
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey;
+import org.apache.eventmesh.common.protocol.http.common.ProtocolKey.EventMeshInstanceKey;
+import org.apache.eventmesh.common.protocol.http.header.Header;
+import org.apache.eventmesh.common.stubs.HeaderStub;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class HttpConvertsUtilsTest {
+
+ private final HeaderStub headerStub = new HeaderStub();
+ private final ProtocolKey mockedProtocolKey = new ProtocolKey();
+ private final EventMeshInstanceKey mockedEventMeshProtocolKey = new EventMeshInstanceKey();
+
+ @Test
+ void httpMapConverts() {
+ Map httpMapConverts = new HttpConvertsUtils().httpMapConverts(headerStub, mockedProtocolKey);
+ Assertions.assertEquals(httpMapConverts.get(headerStub.code), headerStub.code);
+ }
+
+ @Test
+ void testHttpMapConverts() {
+ Map httpMapConverts = new HttpConvertsUtils().httpMapConverts(headerStub, mockedProtocolKey, mockedEventMeshProtocolKey);
+ Assertions.assertEquals(httpMapConverts.get(headerStub.code), headerStub.code);
+ Assertions.assertEquals(httpMapConverts.get(headerStub.eventmeshenv), headerStub.eventmeshenv);
+ }
+
+ @Test
+ void httpHeaderConverts() {
+ HashMap headerParams = new HashMap<>();
+ String code = "test";
+ headerParams.put("code", code);
+ Header header = new HttpConvertsUtils().httpHeaderConverts(headerStub, headerParams);
+ Assertions.assertEquals(code, header.toMap().get("code"));
+ }
+
+ @Test
+ void testHttpHeaderConverts() {
+ HashMap headerParams = new HashMap<>();
+ String env = "test";
+ headerParams.put("eventmeshenv", env);
+ Header header = new HttpConvertsUtils().httpHeaderConverts(headerStub, headerParams, mockedEventMeshProtocolKey);
+ Assertions.assertEquals(env, header.toMap().get("eventmeshenv"));
+ }
+}
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/IPUtilsTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/IPUtilsTest.java
index b3fa293e89..757486dd89 100644
--- a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/IPUtilsTest.java
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/IPUtilsTest.java
@@ -19,16 +19,9 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.SetEnvironmentVariable;
public class IPUtilsTest {
- @Test
- @SetEnvironmentVariable(key = "docker_host_ip", value = "dockHostIP")
- public void testDockerIP() {
- Assertions.assertEquals("dockHostIP", IPUtils.getLocalAddress());
- }
-
@Test
public void testLocalhostIP() {
Assertions.assertNotNull(IPUtils.getLocalAddress());
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/JsonPathUtilsTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/JsonPathUtilsTest.java
new file mode 100644
index 0000000000..e66b8d711a
--- /dev/null
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/JsonPathUtilsTest.java
@@ -0,0 +1,171 @@
+/*
+ * 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.utils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class JsonPathUtilsTest {
+
+ @Test
+ public void tesTisEmptyJsonObject() {
+ String emptyJsonObject = "{}";
+ assertTrue(JsonPathUtils.isEmptyJsonObject(emptyJsonObject));
+
+ String jsonObject = "{\"key\": \"value\"}";
+ assertFalse(JsonPathUtils.isEmptyJsonObject(jsonObject));
+
+ String emptyJsonArray = "[]";
+ assertFalse(JsonPathUtils.isEmptyJsonObject(emptyJsonArray));
+
+ String jsonArray = "[{\"key\": \"value\"}]";
+ assertFalse(JsonPathUtils.isEmptyJsonObject(jsonArray));
+
+ String empty = "";
+ assertFalse(JsonPathUtils.isEmptyJsonObject(empty));
+ }
+
+ @Test
+ public void testParseStrict() {
+ String json = "{\"key\": \"value\"}";
+ JsonNode result = JsonPathUtils.parseStrict(json);
+ assertNotNull(result);
+ assertEquals("value", result.get("key").asText());
+
+ String emptyJsonObject = "{}";
+ JsonNode result2 = JsonPathUtils.parseStrict(emptyJsonObject);
+ assertNotNull(result2);
+ assertTrue(result2.isEmpty());
+
+ }
+
+ @Test
+ public void testBuildJsonString() {
+ Map person = new HashMap<>();
+ person.put("name", "John");
+ person.put("age", "30");
+ String actual = JsonPathUtils.buildJsonString("person", person);
+ String excepted = "{\"person\":{\"name\":\"John\",\"age\":\"30\"}}";
+ assertNotNull(actual);
+ assertEquals(excepted, actual);
+ }
+
+ @Test
+ public void testIsValidAndDefinite() {
+ String jsonPath = "$.person[0].name";
+ String jsonPath2 = "$.person[*].address.city";
+ String jsonPath3 = "person.job[0].title";
+
+ assertTrue(JsonPathUtils.isValidAndDefinite(jsonPath));
+ assertFalse(JsonPathUtils.isValidAndDefinite(jsonPath2));
+ assertFalse(JsonPathUtils.isValidAndDefinite(jsonPath3));
+
+ String jsonPath4 = null;
+ String jsonPath5 = "";
+
+ assertFalse(JsonPathUtils.isValidAndDefinite(jsonPath4));
+ assertFalse(JsonPathUtils.isValidAndDefinite(jsonPath5));
+ }
+
+
+ @Test
+ public void testGetJsonPathValue() {
+ String jsonContent = "{ \"person\": { \"name\": \"John Doe\", \"age\": 30, \"address\": { \"city\": \"New York\" } } }";
+
+ String jsonPath1 = "$.person.name";
+ String jsonPath2 = "$.person.address.city";
+ String jsonPath3 = "$.person.age";
+
+ assertEquals("John Doe", JsonPathUtils.getJsonPathValue(jsonContent, jsonPath1));
+ assertEquals("New York", JsonPathUtils.getJsonPathValue(jsonContent, jsonPath2));
+ assertEquals("30", JsonPathUtils.getJsonPathValue(jsonContent, jsonPath3));
+
+ }
+
+ @Test
+ public void testConvertToJsonNode() throws JsonProcessingException {
+ String jsonString1 = "{\"name\": \"John Doe\", \"age\": 30, \"address\": { \"city\": \"New York\" }}";
+
+ JsonNode node1 = JsonPathUtils.convertToJsonNode(jsonString1);
+ assertEquals("John Doe", node1.get("name").asText());
+ assertEquals("New York", node1.get("address").get("city").asText());
+ assertEquals("30", node1.get("age").asText());
+ }
+
+ @Test
+ public void testMatchJsonPathValueWithString() {
+ String jsonString = "{\"name\": \"John Doe\", \"age\": 30, \"address\": { \"city\": \"New York\" }}";
+
+ String jsonPath1 = "$.name";
+ String result1 = JsonPathUtils.matchJsonPathValueWithString(jsonString, jsonPath1);
+ assertEquals("John Doe", result1);
+
+ String jsonPath2 = "$.age";
+ String result2 = JsonPathUtils.matchJsonPathValueWithString(jsonString, jsonPath2);
+ assertEquals("30", result2); // Age should be returned as a string
+
+ String jsonPath3 = "$.address.city";
+ String result3 = JsonPathUtils.matchJsonPathValueWithString(jsonString, jsonPath3);
+ assertEquals("New York", result3);
+
+ String jsonPath4 = "$.job";
+ String result4 = JsonPathUtils.matchJsonPathValueWithString(jsonString, jsonPath4);
+ assertEquals("null", result4);
+ }
+
+ @Test
+ public void testJsonPathParse() {
+ String jsonString = "{\"name\": \"John Doe\", \"age\": 30, \"address\": { \"city\": \"New York\" }}";
+
+ String jsonPath1 = "$.name";
+ Object result1 = JsonPathUtils.jsonPathParse(jsonString, jsonPath1);
+ assertNotNull(result1);
+ assertEquals("John Doe", result1);
+
+ String jsonPath2 = "$.address.city";
+ Object result2 = JsonPathUtils.jsonPathParse(jsonString, jsonPath2);
+ assertNotNull(result2);
+ assertEquals("New York", result2);
+ }
+
+ @Test
+ public void testMatchJsonPathValue() throws JsonProcessingException {
+ String jsonString = "{\"name\": \"John Doe\", \"age\": 30, \"address\": { \"city\": \"New York\" }}";
+ String jsonPath1 = "$.name";
+ String result1 = JsonPathUtils.matchJsonPathValue(jsonString, jsonPath1);
+ assertEquals("\"John Doe\"", result1);
+
+ String jsonPath2 = "$.address.city";
+ String result2 = JsonPathUtils.matchJsonPathValue(jsonString, jsonPath2);
+ assertEquals("\"New York\"", result2);
+
+ String jsonPath3 = "$.job";
+ String result3 = JsonPathUtils.matchJsonPathValue(jsonString, jsonPath3);
+ assertEquals("null", result3);
+ }
+}
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/LogUtilTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/LogUtilTest.java
new file mode 100644
index 0000000000..03c52dadad
--- /dev/null
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/LogUtilTest.java
@@ -0,0 +1,199 @@
+/*
+ * 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.utils;
+
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.util.function.Supplier;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.slf4j.Logger;
+import org.slf4j.spi.LoggingEventBuilder;
+
+@ExtendWith(MockitoExtension.class)
+class LogUtilTest {
+
+ private Logger mockLogger;
+ private LoggingEventBuilder mockEventBuilder;
+ private Supplier supplier;
+ private String logMessage;
+
+ @BeforeEach
+ void setUp() {
+
+ mockLogger = mock(Logger.class);
+ mockEventBuilder = mock(LoggingEventBuilder.class);
+
+ supplier = () -> "{\"orderId\": 12345, \"amount\": 100}";
+ logMessage = "Processing order with data: {}";
+ }
+
+ @Test
+ void testDebugLogsWithSupplier() {
+
+ doReturn(mockEventBuilder).when(mockLogger).atDebug();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+
+ LogUtil.debug(mockLogger, logMessage, supplier);
+
+ verify(mockLogger).atDebug();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).log(logMessage);
+
+ }
+
+ @Test
+ void testDebugLogsWithSupplierAndException() {
+ Throwable throwable = new RuntimeException("Order processing failed");
+
+
+ doReturn(mockEventBuilder).when(mockLogger).atDebug();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).setCause(throwable);
+
+ LogUtil.debug(mockLogger, logMessage, supplier, throwable);
+
+ verify(mockLogger).atDebug();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).setCause(throwable);
+ verify(mockEventBuilder).log(logMessage);
+ }
+
+ @Test
+ void testDebugLogsWithSuppliers() {
+
+ Supplier supplier2 = () -> "{\"orderId\": 67890, \"amount\": 200}";
+
+ doReturn(mockEventBuilder).when(mockLogger).atDebug();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier2));
+
+ LogUtil.debug(mockLogger, logMessage, supplier, supplier2);
+
+ verify(mockLogger).atDebug();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).addArgument(same(supplier2));
+ verify(mockEventBuilder).log(logMessage);
+ }
+
+ @Test
+ void testInfoLogsWithSupplier() {
+
+ doReturn(mockEventBuilder).when(mockLogger).atInfo();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+
+ LogUtil.info(mockLogger, logMessage, supplier);
+
+ verify(mockLogger).atInfo();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).log(logMessage);
+
+ }
+
+ @Test
+ void testInfoLogsWithSupplierAndException() {
+
+ Throwable throwable = new RuntimeException("Order processing failed");
+
+ doReturn(mockEventBuilder).when(mockLogger).atInfo();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).setCause(throwable);
+
+ LogUtil.info(mockLogger, logMessage, supplier, throwable);
+
+ verify(mockLogger).atInfo();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).setCause(throwable);
+ verify(mockEventBuilder).log(logMessage);
+
+ }
+
+ @Test
+ void testInfoLogsWithSuppliers() {
+
+ Supplier supplier2 = () -> "{\"orderId\": 67890, \"amount\": 200}";
+
+ doReturn(mockEventBuilder).when(mockLogger).atInfo();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier2));
+
+ LogUtil.info(mockLogger, logMessage, supplier, supplier2);
+
+ verify(mockLogger).atInfo();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).addArgument(same(supplier2));
+ verify(mockEventBuilder).log(logMessage);
+ }
+
+ @Test
+ void testWarnLogsWithSupplier() {
+
+ doReturn(mockEventBuilder).when(mockLogger).atWarn();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+
+ LogUtil.warn(mockLogger, logMessage, supplier);
+
+ verify(mockLogger).atWarn();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).log(logMessage);
+
+ }
+
+ @Test
+ void testWarnLogsWithSupplierAndException() {
+
+ Throwable throwable = new RuntimeException("Order processing failed");
+
+ doReturn(mockEventBuilder).when(mockLogger).atWarn();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).setCause(throwable);
+
+ LogUtil.warn(mockLogger, logMessage, supplier, throwable);
+
+ verify(mockLogger).atWarn();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).setCause(throwable);
+ verify(mockEventBuilder).log(logMessage);
+
+ }
+
+ @Test
+ void testWarnLogsWithSuppliers() {
+
+ Supplier supplier2 = () -> "{\"orderId\": 67890, \"amount\": 200}";
+
+ doReturn(mockEventBuilder).when(mockLogger).atWarn();
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier));
+ doReturn(mockEventBuilder).when(mockEventBuilder).addArgument(same(supplier2));
+
+ LogUtil.warn(mockLogger, logMessage, supplier, supplier2);
+
+ verify(mockLogger).atWarn();
+ verify(mockEventBuilder).addArgument(same(supplier));
+ verify(mockEventBuilder).addArgument(same(supplier2));
+ verify(mockEventBuilder).log(logMessage);
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/ThreadUtilsTest.java b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/ThreadUtilsTest.java
new file mode 100644
index 0000000000..0cba2a6ad9
--- /dev/null
+++ b/eventmesh-common/src/test/java/org/apache/eventmesh/common/utils/ThreadUtilsTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.utils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+class ThreadUtilsTest {
+
+ @Test
+ void testRandomPauseBetweenMinAndMax() {
+
+ long min = 1000;
+ long max = 5000;
+
+ long start = System.currentTimeMillis();
+ ThreadUtils.randomPause(min, max, TimeUnit.MILLISECONDS);
+ long end = System.currentTimeMillis();
+
+ long pause = end - start;
+
+ assertTrue(pause >= min && pause <= max, "Pause time should be between min and max");
+ }
+
+ @Test
+ void testRandomPauseWithInterruption() {
+
+ Thread.currentThread().interrupt();
+ ThreadUtils.randomPause(1000, 2000, TimeUnit.MILLISECONDS);
+ assertTrue(Thread.currentThread().isInterrupted());
+ }
+
+ @Test
+ void testDeprecatedSleep() {
+
+ ThreadUtils.sleep(1000);
+ assertTrue(true, "Method should execute without any exception");
+ }
+
+ @Test
+ void testSleepWithTimeOutAndTimeUnit() throws InterruptedException {
+
+ ThreadUtils.sleepWithThrowException(5000, TimeUnit.MILLISECONDS);
+ assertTrue(true, "Method should execute without any exception");
+ }
+
+ @Test
+ void testSleepWithNullTimeUnit() throws InterruptedException {
+
+ ThreadUtils.sleepWithThrowException(5000, null);
+ assertTrue(true, "Method should not throw any exception with null TimeUnit");
+ }
+
+ @Test
+ void testSleepWithThrowExceptionInterruption() {
+ Thread.currentThread().interrupt();
+
+ assertThrows(InterruptedException.class, () -> {
+ ThreadUtils.sleepWithThrowException(5000, TimeUnit.MILLISECONDS);
+ });
+ }
+
+ @Test
+ void testGetPIDWithRealProcessId() {
+
+ long pid = ThreadUtils.getPID();
+ assertTrue(pid > 0);
+
+ long cashedPId = ThreadUtils.getPID();
+ assertEquals(pid, cashedPId);
+ }
+
+ @Test
+ void testGetPIDWithMultiThread() throws InterruptedException {
+
+ final long[] pid1 = new long[1];
+ final long[] pid2 = new long[1];
+
+ Thread thread1 = new Thread(() -> {
+ pid1[0] = ThreadUtils.getPID();
+ assertTrue(pid1[0] > 0);
+ });
+
+ Thread thread2 = new Thread(() -> {
+ pid2[0] = ThreadUtils.getPID();
+ assertTrue(pid2[0] > 0);
+ });
+
+ thread1.start();
+ thread2.start();
+
+ thread1.join();
+ thread2.join();
+
+ assertEquals(pid1[0], pid2[0]);
+ }
+}
\ No newline at end of file
diff --git a/eventmesh-connectors/eventmesh-connector-canal/build.gradle b/eventmesh-connectors/eventmesh-connector-canal/build.gradle
new file mode 100644
index 0000000000..6beeac41eb
--- /dev/null
+++ b/eventmesh-connectors/eventmesh-connector-canal/build.gradle
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+List canal = [
+ "com.alibaba.otter:canal.instance.manager:$canal_version",
+ "com.alibaba.otter:canal.parse:$canal_version",
+ "com.alibaba.otter:canal.server:$canal_version"
+]
+
+dependencies {
+ api project(":eventmesh-openconnect:eventmesh-openconnect-java")
+ implementation "org.locationtech.jts:jts-core"
+ implementation project(":eventmesh-common")
+ implementation canal
+ implementation "com.alibaba:druid"
+ compileOnly 'com.mysql:mysql-connector-j'
+ compileOnly 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+ testImplementation "org.mockito:mockito-core"
+ testImplementation "org.mockito:mockito-junit-jupiter"
+}
\ No newline at end of file
diff --git a/eventmesh-connectors/eventmesh-connector-canal/gradle.properties b/eventmesh-connectors/eventmesh-connector-canal/gradle.properties
new file mode 100644
index 0000000000..a439bdacf9
--- /dev/null
+++ b/eventmesh-connectors/eventmesh-connector-canal/gradle.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.
+#
+canal_version=1.1.7
+pluginType=connector
+pluginName=MySQL
\ No newline at end of file
diff --git a/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/ByteArrayConverter.java b/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/ByteArrayConverter.java
new file mode 100644
index 0000000000..350b678856
--- /dev/null
+++ b/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/ByteArrayConverter.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.connector.canal;
+
+import org.apache.commons.beanutils.ConversionException;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.beanutils.converters.ArrayConverter;
+import org.apache.commons.beanutils.converters.ByteConverter;
+
+import java.nio.charset.StandardCharsets;
+
+
+public class ByteArrayConverter implements Converter {
+
+ public static final Converter SQL_BYTES = new ByteArrayConverter(null);
+ private static final Converter converter = new ArrayConverter(byte[].class, new ByteConverter());
+
+ protected final Object defaultValue;
+ protected final boolean useDefault;
+
+ public ByteArrayConverter() {
+ this.defaultValue = null;
+ this.useDefault = false;
+ }
+
+ public ByteArrayConverter(Object defaultValue) {
+ this.defaultValue = defaultValue;
+ this.useDefault = true;
+ }
+
+ public Object convert(Class type, Object value) {
+ if (value == null) {
+ if (useDefault) {
+ return (defaultValue);
+ } else {
+ throw new ConversionException("No value specified");
+ }
+ }
+
+ if (value instanceof byte[]) {
+ return (value);
+ }
+
+ if (value instanceof String) {
+ try {
+ return ((String) value).getBytes(StandardCharsets.ISO_8859_1);
+ } catch (Exception e) {
+ throw new ConversionException(e);
+ }
+ }
+
+ return converter.convert(type, value);
+ }
+}
diff --git a/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/CanalConnectRecord.java b/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/CanalConnectRecord.java
new file mode 100644
index 0000000000..6f112081e8
--- /dev/null
+++ b/eventmesh-connectors/eventmesh-connector-canal/src/main/java/org/apache/eventmesh/connector/canal/CanalConnectRecord.java
@@ -0,0 +1,284 @@
+/*
+ * 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.connector.canal;
+
+import org.apache.eventmesh.common.remote.job.SyncConsistency;
+import org.apache.eventmesh.common.remote.job.SyncMode;
+import org.apache.eventmesh.connector.canal.model.EventColumn;
+import org.apache.eventmesh.connector.canal.model.EventType;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+public class CanalConnectRecord implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String schemaName;
+
+ private String tableName;
+
+ // mysql instance gtid range
+ private String gtid;
+
+ private String currentGtid;
+
+ /**
+ * The business type of the changed data (I/U/D/C/A/E), consistent with the EventType defined in EntryProtocol in canal.
+ */
+ private EventType eventType;
+
+ /**
+ * The business time of the changed data.
+ */
+ private long executeTime;
+
+ /**
+ * The primary key value before the change, if it is insert/delete, the primary key value before and after the change is the same.
+ */
+ private List oldKeys = new ArrayList();
+
+ /**
+ * The primary key value after the change, if it is insert/delete, the primary key value before and after the change is the same.
+ */
+ private List keys = new ArrayList();
+
+ /**
+ * Other fields that are not primary keys
+ */
+ private List columns = new ArrayList();
+
+ // ====================== Additional properties of the data during the running process =============================
+ /**
+ * The expected size, based on the estimation of the binlog event
+ */
+ private long size = 1024;
+
+ /**
+ * The id of the synchronization mapping relationship
+ */
+ private long pairId = -1;
+
+ /**
+ * When eventType = CREATE/ALTER/ERASE, it is the corresponding SQL statement, other situations are dynamically generated INSERT/UPDATE/DELETE sql
+ */
+ private String sql;
+
+ /**
+ * The schemaName of ddl/query, there will be cross-database ddl, need to keep the current schemaName of executing ddl
+ */
+ private String ddlSchemaName;
+
+ /**
+ * Custom synchronization mode, allows to override the default pipeline parameter, such as for remedial data synchronization
+ */
+ private SyncMode syncMode;
+
+ /**
+ * Custom synchronization consistency, allows to override the default pipeline parameter,
+ * such as forcing the database to be queried for field groups
+ */
+ private SyncConsistency syncConsistency;
+
+ /**
+ * Whether it is remedy data, such as data automatically generated by loopback remedy, or manual correction data produced by freedom
+ */
+ private boolean remedy = false;
+
+ /**
+ * Generate the corresponding hint content
+ */
+ private String hint;
+
+ /**
+ * Whether to ignore the schema when generating SQL, such as for tddl/drds, need to ignore the schema
+ */
+ private boolean withoutSchema = false;
+
+ private String journalName;
+
+ private long binLogOffset;
+
+ public CanalConnectRecord() {
+ super();
+ }
+
+ // ======================== helper method =================
+
+ /**
+ * Return all fields to be changed
+ */
+ public List