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..7c792b7d3e 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.DEVELOCITY_ACCESS_KEY }}
- 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.DEVELOCITY_ACCESS_KEY }}
- name: Install plugin
run: ./gradlew installPlugin --scan
env:
- GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- 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..dbda7eab6b 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.DEVELOCITY_ACCESS_KEY }}
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index dfb36970d0..171c787369 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -41,10 +41,10 @@ jobs:
apache/eventmesh
- name: Build and push
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./docker/Dockerfile_jdk8
- context: ./
+ context: ./
\ No newline at end of file
diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml
index ca0e0936a6..9172e85414 100644
--- a/.github/workflows/license.yml
+++ b/.github/workflows/license.yml
@@ -38,7 +38,7 @@ jobs:
java-version: 11
- name: Setup Gradle
- uses: gradle/actions/setup-gradle@v3
+ uses: gradle/actions/setup-gradle@v4
- name: Check license compatibility
run: ./gradlew clean checkDeniedLicense
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index c1e4f4ab15..8b5b166215 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -42,7 +42,7 @@ jobs:
It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.
If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.
- exempt-issue-labels: 'pinned,discussion,help wanted,WIP,weopen-star,GLCC,summer of code'
+ exempt-issue-labels: 'pinned,discussion,help wanted,WIP,weopen-star,GLCC,GSoC'
exempt-pr-labels: 'help wanted,dependencies'
exempt-all-milestones: true # Exempt all issues/PRs with milestones from stale
operations-per-run: 300
diff --git a/.idea/icon.png b/.idea/icon.png
deleted file mode 100644
index 59aa06dac9..0000000000
Binary files a/.idea/icon.png and /dev/null differ
diff --git a/README.md b/README.md
index 67944cbb51..b9975018dd 100644
--- a/README.md
+++ b/README.md
@@ -180,26 +180,21 @@ eventmesh-runtime-0-a-0 1/1 Running 0 15s
## Contributing
+[![GitHub repo Good Issues for newbies](https://img.shields.io/github/issues/apache/eventmesh/good%20first%20issue?style=flat&logo=github&logoColor=green&label=Good%20First%20issues)](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) [![GitHub Help Wanted issues](https://img.shields.io/github/issues/apache/eventmesh/help%20wanted?style=flat&logo=github&logoColor=b545d1&label=%22Help%20Wanted%22%20issues)](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) [![GitHub Help Wanted PRs](https://img.shields.io/github/issues-pr/apache/eventmesh/help%20wanted?style=flat&logo=github&logoColor=b545d1&label=%22Help%20Wanted%22%20PRs)](https://github.com/apache/eventmesh/pulls?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) [![GitHub repo Issues](https://img.shields.io/github/issues/apache/eventmesh?style=flat&logo=github&logoColor=red&label=Issues)](https://github.com/apache/eventmesh/issues?q=is%3Aopen)
+
Each contributor has played an important role in promoting the robust development of Apache EventMesh. We sincerely appreciate all contributors who have contributed code and documents.
- [Contributing Guideline](https://eventmesh.apache.org/community/contribute/contribute)
- [Good First Issues](https://github.com/apache/eventmesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
-Here is the [List of Contributors](https://github.com/apache/eventmesh/graphs/contributors), thank you all! :)
-
-
-
-
-
## CNCF Landscape
diff --git a/build.gradle b/build.gradle
index 3fc27890d1..ca9804cec0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -42,17 +42,17 @@ buildscript {
dependencies {
classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.5"
- classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
+ classpath "io.spring.gradle:dependency-management-plugin:1.1.6"
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.13.0"
classpath "org.apache.httpcomponents:httpclient:4.5.14"
- classpath "commons-io:commons-io:2.11.0"
+ classpath "commons-io:commons-io:2.18.0"
}
}
plugins {
id 'org.cyclonedx.bom' version '1.8.2'
- id 'com.github.jk1.dependency-license-report' version '2.7'
+ id 'com.github.jk1.dependency-license-report' version '2.9'
}
allprojects {
@@ -95,10 +95,12 @@ allprojects {
checkstyleMain.exclude('**/org/apache/eventmesh/client/grpc/protos**')
.exclude('**/org/apache/eventmesh/common/protocol/grpc/cloudevents**')
- .exclude('**/org/apache/eventmesh/common/protocol/grpc/protos/**')
+ .exclude('**/org/apache/eventmesh/common/protocol/grpc/proto**')
+ .exclude('**/org/apache/eventmesh/common/protocol/grpc/adminserver/**')
.exclude('**/org/apache/eventmesh/connector/openfunction/client/EventMeshGrpcService**')
.exclude('**/org/apache/eventmesh/connector/openfunction/client/CallbackServiceGrpc**')
.exclude('**/org/apache/eventmesh/connector/jdbc/antlr**')
+ .exclude('**/org/apache/eventmesh/meta/raft/rpc/**')
dependencies {
repositories {
@@ -107,7 +109,7 @@ allprojects {
url "https://maven.aliyun.com/repository/public"
}
}
- testImplementation "org.junit.jupiter:junit-jupiter:5.6.0"
+ testImplementation "org.junit.jupiter:junit-jupiter:5.11.0"
}
spotless {
@@ -161,17 +163,18 @@ 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",
"eventmesh-storage-plugin:eventmesh-storage-api",
- "eventmesh-trace-plugin:eventmesh-trace-api",
- "eventmesh-webhook:eventmesh-webhook-api",
- "eventmesh-webhook:eventmesh-webhook-admin",
- "eventmesh-webhook:eventmesh-webhook-receive"]
+ "eventmesh-trace-plugin:eventmesh-trace-api"]
doLast {
includedProjects.each {
def subProject = findProject(it)
@@ -204,6 +207,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 +447,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 +694,30 @@ subprojects {
sign publishing.publications.mavenJava
}
- def grpcVersion = '1.64.0'
- def log4jVersion = '2.23.1'
- def jacksonVersion = '2.17.1'
- def dropwizardMetricsVersion = '4.2.25'
+ def grpcVersion = '1.68.0'
+ def log4jVersion = '2.24.1'
+ def jacksonVersion = '2.18.0'
+ def dropwizardMetricsVersion = '4.2.26'
def opentelemetryVersion = '1.36.0'
- def cloudeventsVersion = '2.5.0'
- def curatorVersion = '5.6.0'
- def mockitoVersion = '3.12.4'
+ def cloudeventsVersion = '3.0.0'
+ def curatorVersion = '5.7.0'
+ def mockitoVersion = '4.11.0'
dependencyManagement {
dependencies {
- dependency "org.apache.commons:commons-lang3:3.6"
+ dependency "org.apache.commons:commons-lang3:3.17.0"
dependency "org.apache.commons:commons-collections4:4.4"
- dependency "org.apache.commons:commons-text:1.9"
-
- dependency "commons-io:commons-io:2.11.0"
-
- dependency "commons-validator:commons-validator:1.7"
-
- dependency "com.google.guava:guava:31.1-jre"
+ dependency "org.apache.commons:commons-text:1.12.0"
+ dependency "commons-io:commons-io:2.18.0"
+ dependency "commons-validator:commons-validator:1.9.0"
+ dependency "com.google.guava:guava:33.3.0-jre"
dependency "org.slf4j:slf4j-api:2.0.13"
dependency "org.apache.logging.log4j:log4j-api:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-core:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
- dependency "com.lmax:disruptor:3.4.2"
+ dependency "com.lmax:disruptor:3.4.4"
dependency "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
dependency "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
@@ -684,10 +727,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 +747,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 +774,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 +787,18 @@ subprojects {
dependency "org.apache.curator:curator-recipes:${curatorVersion}"
dependency "org.apache.curator:curator-test:${curatorVersion}"
- dependency "org.projectlombok:lombok:1.18.32"
- dependency "com.github.seancfoley:ipaddress:5.3.3"
+ dependency "org.projectlombok:lombok:1.18.34"
dependency "javax.annotation:javax.annotation-api:1.3.2"
- dependency "com.alibaba.fastjson2:fastjson2:2.0.48"
+ dependency "com.alibaba.fastjson2:fastjson2:2.0.52"
- dependency "software.amazon.awssdk:s3:2.25.55"
+ dependency "software.amazon.awssdk:s3:2.29.5"
dependency "com.github.rholder:guava-retrying:2.0.0"
+
+ dependency "com.alibaba:druid-spring-boot-starter:1.2.23"
+ dependency "com.baomidou:mybatis-plus-boot-starter:3.5.7"
+ dependency "com.mysql:mysql-connector-j:8.4.0"
+ dependency "org.springframework.boot:spring-boot-starter-jetty:2.7.18"
+ dependency "org.locationtech.jts:jts-core:1.20.0"
}
}
}
diff --git a/eventmesh-admin-server/.gitignore b/eventmesh-admin-server/.gitignore
new file mode 100644
index 0000000000..b63da4551b
--- /dev/null
+++ b/eventmesh-admin-server/.gitignore
@@ -0,0 +1,42 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/eventmesh-admin-server/bin/start-admin.sh b/eventmesh-admin-server/bin/start-admin.sh
new file mode 100644
index 0000000000..1633036617
--- /dev/null
+++ b/eventmesh-admin-server/bin/start-admin.sh
@@ -0,0 +1,200 @@
+#!/bin/bash
+#
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#===========================================================================================
+# Java Environment Setting
+#===========================================================================================
+set -e
+# Server configuration may be inconsistent, add these configurations to avoid garbled code problems
+export LANG=en_US.UTF-8
+export LC_CTYPE=en_US.UTF-8
+export LC_ALL=en_US.UTF-8
+
+TMP_JAVA_HOME="/customize/your/java/home/here"
+
+# Detect operating system.
+OS=$(uname)
+
+function is_java8_or_11 {
+ local _java="$1"
+ [[ -x "$_java" ]] || return 1
+ [[ "$("$_java" -version 2>&1)" =~ 'java version "1.8' || "$("$_java" -version 2>&1)" =~ 'openjdk version "1.8' || "$("$_java" -version 2>&1)" =~ 'java version "11' || "$("$_java" -version 2>&1)" =~ 'openjdk version "11' ]] || return 2
+ return 0
+}
+
+function extract_java_version {
+ local _java="$1"
+ local version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{if ($1 == 1 && $2 == 8) print "8"; else if ($1 == 11) print "11"; else print "unknown"}')
+ echo "$version"
+}
+
+# 0(not running), 1(is running)
+#function is_proxyRunning {
+# local _pid="$1"
+# local pid=`ps ax | grep -i 'org.apache.eventmesh.runtime.boot.EventMeshStartup' |grep java | grep -v grep | awk '{print $1}'|grep $_pid`
+# if [ -z "$pid" ] ; then
+# return 0
+# else
+# return 1
+# fi
+#}
+
+function get_pid {
+ local ppid=""
+ if [ -f ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file ]; then
+ ppid=$(cat ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file)
+ # If the process does not exist, it indicates that the previous process terminated abnormally.
+ if [ ! -d /proc/$ppid ]; then
+ # Remove the residual file.
+ rm ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+ echo -e "ERROR\t EventMesh process had already terminated unexpectedly before, please check log output."
+ ppid=""
+ fi
+ else
+ if [[ $OS =~ Msys ]]; then
+ # There is a Bug on Msys that may not be able to kill the identified process
+ ppid=`jps -v | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ elif [[ $OS =~ Darwin ]]; then
+ # Known problem: grep Java may not be able to accurately identify Java processes
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ else
+ if [ $DOCKER ]; then
+ # No need to exclude root user in Docker containers.
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | awk -F ' ' {'print $2'})
+ else
+ # It is required to identify the process as accurately as possible on Linux.
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" | awk -F ' ' {'print $2'})
+ fi
+ fi
+ fi
+ echo "$ppid";
+}
+
+#===========================================================================================
+# Locate Java Executable
+#===========================================================================================
+
+if [[ -d "$TMP_JAVA_HOME" ]] && is_java8_or_11 "$TMP_JAVA_HOME/bin/java"; then
+ JAVA="$TMP_JAVA_HOME/bin/java"
+ JAVA_VERSION=$(extract_java_version "$TMP_JAVA_HOME/bin/java")
+elif [[ -d "$JAVA_HOME" ]] && is_java8_or_11 "$JAVA_HOME/bin/java"; then
+ JAVA="$JAVA_HOME/bin/java"
+ JAVA_VERSION=$(extract_java_version "$JAVA_HOME/bin/java")
+elif is_java8_or_11 "$(which java)"; then
+ JAVA="$(which java)"
+ JAVA_VERSION=$(extract_java_version "$(which java)")
+else
+ echo -e "ERROR\t Java 8 or 11 not found, operation abort."
+ exit 9;
+fi
+
+echo "EventMesh using Java version: $JAVA_VERSION, path: $JAVA"
+
+EVENTMESH_ADMIN_HOME=$(cd "$(dirname "$0")/.." && pwd)
+export EVENTMESH_ADMIN_HOME
+
+EVENTMESH_ADMIN_LOG_HOME="${EVENTMESH_ADMIN_HOME}/logs"
+export EVENTMESH_ADMIN_LOG_HOME
+
+echo -e "EVENTMESH_ADMIN_HOME : ${EVENTMESH_ADMIN_HOME}\nEVENTMESH_ADMIN_LOG_HOME : ${EVENTMESH_ADMIN_LOG_HOME}"
+
+function make_logs_dir {
+ if [ ! -e "${EVENTMESH_ADMIN_LOG_HOME}" ]; then mkdir -p "${EVENTMESH_ADMIN_LOG_HOME}"; fi
+}
+
+error_exit ()
+{
+ echo -e "ERROR\t $1 !!"
+ exit 1
+}
+
+export JAVA_HOME
+
+#===========================================================================================
+# JVM Configuration
+#===========================================================================================
+#if [ $1 = "prd" -o $1 = "benchmark" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms2048M -Xmx4096M -Xmn2048m -XX:SurvivorRatio=4"
+#elif [ $1 = "sit" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms256M -Xmx512M -Xmn256m -XX:SurvivorRatio=4"
+#elif [ $1 = "dev" ]; then JAVA_OPT="${JAVA_OPT} -server -Xms128M -Xmx256M -Xmn128m -XX:SurvivorRatio=4"
+#fi
+
+GC_LOG_FILE="${EVENTMESH_ADMIN_LOG_HOME}/eventmesh_admin_gc_%p.log"
+
+JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g"
+JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:MaxGCPauseMillis=50"
+JAVA_OPT="${JAVA_OPT} -verbose:gc"
+if [[ "$JAVA_VERSION" == "8" ]]; then
+ # Set JAVA_OPT for Java 8
+ JAVA_OPT="${JAVA_OPT} -Xloggc:${GC_LOG_FILE} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m"
+ JAVA_OPT="${JAVA_OPT} -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy"
+elif [[ "$JAVA_VERSION" == "11" ]]; then
+ # Set JAVA_OPT for Java 11
+ XLOG_PARAM="time,level,tags:filecount=5,filesize=30m"
+ JAVA_OPT="${JAVA_OPT} -Xlog:gc*:${GC_LOG_FILE}:${XLOG_PARAM}"
+ JAVA_OPT="${JAVA_OPT} -Xlog:safepoint:${GC_LOG_FILE}:${XLOG_PARAM} -Xlog:ergo*=debug:${GC_LOG_FILE}:${XLOG_PARAM}"
+fi
+JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${EVENTMESH_ADMIN_LOG_HOME} -XX:ErrorFile=${EVENTMESH_ADMIN_LOG_HOME}/hs_err_%p.log"
+JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow"
+JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch"
+JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=8G"
+JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking"
+JAVA_OPT="${JAVA_OPT} -Dio.netty.leakDetectionLevel=advanced"
+JAVA_OPT="${JAVA_OPT} -Dio.netty.allocator.type=pooled"
+JAVA_OPT="${JAVA_OPT} -Djava.security.egd=file:/dev/./urandom"
+JAVA_OPT="${JAVA_OPT} -Dlog4j.configurationFile=${EVENTMESH_ADMIN_HOME}/conf/log4j2.xml"
+JAVA_OPT="${JAVA_OPT} -Deventmesh.log.home=${EVENTMESH_ADMIN_LOG_HOME}"
+JAVA_OPT="${JAVA_OPT} -DconfPath=${EVENTMESH_ADMIN_HOME}/conf"
+JAVA_OPT="${JAVA_OPT} -DconfigurationPath=${EVENTMESH_ADMIN_HOME}/conf"
+JAVA_OPT="${JAVA_OPT} -Dlog4j2.AsyncQueueFullPolicy=Discard"
+JAVA_OPT="${JAVA_OPT} -Drocketmq.client.logUseSlf4j=true"
+JAVA_OPT="${JAVA_OPT} -DeventMeshPluginDir=${EVENTMESH_ADMIN_HOME}/plugin"
+
+#if [ -f "pid.file" ]; then
+# pid=`cat pid.file`
+# if ! is_proxyRunning "$pid"; then
+# echo "proxy is running already"
+# exit 9;
+# else
+# echo "err pid$pid, rm pid.file"
+# rm pid.file
+# fi
+#fi
+
+pid=$(get_pid)
+if [[ $pid == "ERROR"* ]]; then
+ echo -e "${pid}"
+ exit 9
+fi
+if [ -n "$pid" ]; then
+ echo -e "ERROR\t The server is already running (pid=$pid), there is no need to execute start.sh again."
+ exit 9
+fi
+
+make_logs_dir
+
+echo "Using Java version: $JAVA_VERSION, path: $JAVA" >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out
+
+EVENTMESH_ADMIN_MAIN=org.apache.eventmesh.admin.server.ExampleAdminServer
+if [ $DOCKER ]; then
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME}/conf:${EVENTMESH_ADMIN_HOME}/apps/*:${EVENTMESH_ADMIN_HOME}/lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out
+else
+ $JAVA $JAVA_OPT -classpath ${EVENTMESH_ADMIN_HOME}/conf:${EVENTMESH_ADMIN_HOME}/apps/*:${EVENTMESH_ADMIN_HOME}/lib/* $EVENTMESH_ADMIN_MAIN >> ${EVENTMESH_ADMIN_LOG_HOME}/eventmesh-admin.out 2>&1 &
+echo $!>${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+fi
+exit 0
diff --git a/eventmesh-admin-server/bin/stop-admin.sh b/eventmesh-admin-server/bin/stop-admin.sh
new file mode 100644
index 0000000000..207531d7fa
--- /dev/null
+++ b/eventmesh-admin-server/bin/stop-admin.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+#
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Detect operating system
+OS=$(uname)
+
+EVENTMESH_ADMIN_HOME=`cd $(dirname $0)/.. && pwd`
+
+export EVENTMESH_ADMIN_HOME
+
+function get_pid {
+ local ppid=""
+ if [ -f ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file ]; then
+ ppid=$(cat ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file)
+ # If the process does not exist, it indicates that the previous process terminated abnormally.
+ if [ ! -d /proc/$ppid ]; then
+ # Remove the residual file and return an error status.
+ rm ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file
+ echo -e "ERROR\t EventMesh admin process had already terminated unexpectedly before, please check log output."
+ ppid=""
+ fi
+ else
+ if [[ $OS =~ Msys ]]; then
+ # There is a Bug on Msys that may not be able to kill the identified process
+ ppid=`jps -v | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {'print $1'}`
+ elif [[ $OS =~ Darwin ]]; then
+ # Known problem: grep Java may not be able to accurately identify Java processes
+ ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ else
+ # It is required to identify the process as accurately as possible on Linux
+ ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'})
+ fi
+ fi
+ echo "$ppid";
+}
+
+pid=$(get_pid)
+if [[ $pid == "ERROR"* ]]; then
+ echo -e "${pid}"
+ exit 9
+fi
+if [ -z "$pid" ];then
+ echo -e "ERROR\t No EventMesh admin server running."
+ exit 9
+fi
+
+kill ${pid}
+echo "Send shutdown request to EventMesh admin(${pid}) OK"
+
+[[ $OS =~ Msys ]] && PS_PARAM=" -W "
+stop_timeout=60
+for no in $(seq 1 $stop_timeout); do
+ if ps $PS_PARAM -p "$pid" 2>&1 > /dev/null; then
+ if [ $no -lt $stop_timeout ]; then
+ echo "[$no] server shutting down ..."
+ sleep 1
+ continue
+ fi
+
+ echo "shutdown server timeout, kill process: $pid"
+ kill -9 $pid; sleep 1; break;
+ echo "`date +'%Y-%m-%-d %H:%M:%S'` , pid : [$pid] , error message : abnormal shutdown which can not be closed within 60s" > ../logs/shutdown.error
+ else
+ echo "shutdown server ok!"; break;
+ fi
+done
+
+if [ -f "pid-admin.file" ]; then
+ rm pid-admin.file
+fi
+
+
diff --git a/eventmesh-admin-server/build.gradle b/eventmesh-admin-server/build.gradle
new file mode 100644
index 0000000000..fdfe1bffe8
--- /dev/null
+++ b/eventmesh-admin-server/build.gradle
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dependencies {
+ implementation project(":eventmesh-spi")
+ implementation project(":eventmesh-common")
+ implementation project(":eventmesh-registry:eventmesh-registry-api")
+ implementation project(":eventmesh-registry:eventmesh-registry-nacos")
+ implementation project(":eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api")
+ implementation "com.alibaba.nacos:nacos-client"
+ implementation("org.springframework.boot:spring-boot-starter-web") {
+ exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
+ }
+ implementation 'org.springframework.boot:spring-boot-starter-jetty'
+ implementation "io.grpc:grpc-core"
+ implementation "io.grpc:grpc-protobuf"
+ implementation "io.grpc:grpc-stub"
+ implementation "io.grpc:grpc-netty-shaded"
+
+ // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
+ implementation "com.baomidou:mybatis-plus-boot-starter"
+
+ // https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter
+ implementation "com.alibaba:druid-spring-boot-starter"
+ compileOnly 'com.mysql:mysql-connector-j'
+ compileOnly 'org.projectlombok:lombok'
+ testImplementation 'junit:junit:4.13.2'
+ testImplementation 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+}
+
+configurations.implementation {
+ exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
+}
+
+sourceSets {
+ main {
+ resources {
+ srcDirs = ['src/main/resources', 'conf']
+ }
+ }
+}
+
diff --git a/eventmesh-admin-server/conf/application.yaml b/eventmesh-admin-server/conf/application.yaml
new file mode 100644
index 0000000000..7765d90ce8
--- /dev/null
+++ b/eventmesh-admin-server/conf/application.yaml
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+spring:
+ datasource:
+ url: jdbc:mysql://localhost:3306/eventmesh?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
+ username: //db_username
+ password: //db_password
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ initialSize: 1
+ minIdle: 1
+ maxActive: 20
+ maxWait: 10000
+ timeBetweenEvictionRunsMillis: 60000
+ minEvictableIdleTimeMillis: 300000
+ validationQuery: SELECT 1 FROM DUAL
+ testWhileIdle: true
+ testOnBorrow: false
+ testOnReturn: false
+ poolPreparedStatements: false
+ maxPoolPreparedStatementPerConnectionSize: 20
+ filters: stat
+ connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000"
+# secret keys
+sysPubKey:
+appPrivKey:
+
+mybatis-plus:
+ mapper-locations: classpath:mapper/*.xml
+ configuration:
+ map-underscore-to-camel-case: false
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# http server port
+server:
+ port: 8082
+event-mesh:
+ admin-server:
+ serviceName: DEFAULT_GROUP@@em_adm_server
+ # grpc server port
+ port: 8081
+ adminServerList:
+ R1: http://localhost:8082;http://localhost:8082
+ R2: http://localhost:8092;http://localhost:8092
+ region: R1
\ No newline at end of file
diff --git a/eventmesh-admin-server/conf/eventmesh-admin.properties b/eventmesh-admin-server/conf/eventmesh-admin.properties
new file mode 100644
index 0000000000..30507ec02c
--- /dev/null
+++ b/eventmesh-admin-server/conf/eventmesh-admin.properties
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+eventMesh.registry.plugin.type=nacos
+eventMesh.registry.plugin.server-addr=localhost:8848
diff --git a/eventmesh-admin-server/conf/eventmesh.sql b/eventmesh-admin-server/conf/eventmesh.sql
new file mode 100644
index 0000000000..4d11ab1585
--- /dev/null
+++ b/eventmesh-admin-server/conf/eventmesh.sql
@@ -0,0 +1,185 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET NAMES utf8 */;
+/*!50503 SET NAMES utf8 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+-- export eventmesh database
+CREATE DATABASE IF NOT EXISTS `eventmesh` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */ /*!80016 DEFAULT ENCRYPTION='N' */;
+USE `eventmesh`;
+
+-- export table eventmesh.event_mesh_data_source structure
+CREATE TABLE IF NOT EXISTS `event_mesh_data_source` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `dataType` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `description` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `configuration` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `configurationClass` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `region` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_job_info structure
+CREATE TABLE IF NOT EXISTS `event_mesh_job_info` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `jobDesc` varchar(50) COLLATE utf8_bin NOT NULL,
+ `taskID` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `transportType` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `sourceData` int NOT NULL DEFAULT '0',
+ `targetData` int NOT NULL DEFAULT '0',
+ `jobState` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `jobType` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `fromRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `runningRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `updateUid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE KEY `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_mysql_position structure
+CREATE TABLE IF NOT EXISTS `event_mesh_mysql_position` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `serverUUID` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `position` bigint DEFAULT NULL,
+ `gtid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `currentGtid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `timestamp` bigint DEFAULT NULL,
+ `journalName` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC;
+
+-- export table eventmesh.event_mesh_position_reporter_history structure
+CREATE TABLE IF NOT EXISTS `event_mesh_position_reporter_history` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `job` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `record` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ KEY `job` (`job`),
+ KEY `address` (`address`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='record position reporter changes';
+
+-- export table eventmesh.event_mesh_runtime_heartbeat structure
+CREATE TABLE IF NOT EXISTS `event_mesh_runtime_heartbeat` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT,
+ `adminAddr` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `runtimeAddr` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `reportTime` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'runtime local report time',
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ KEY `jobID` (`jobID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_runtime_history structure
+CREATE TABLE IF NOT EXISTS `event_mesh_runtime_history` (
+ `id` bigint NOT NULL AUTO_INCREMENT,
+ `job` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `address` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ KEY `address` (`address`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC COMMENT='record runtime task change history';
+
+-- export table eventmesh.event_mesh_task_info structure
+CREATE TABLE IF NOT EXISTS `event_mesh_task_info` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8_bin NOT NULL,
+ `taskName` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `taskDesc` varchar(50) COLLATE utf8_bin NOT NULL,
+ `taskState` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'taskstate',
+ `sourceRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `targetRegion` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `createUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `updateUid` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE KEY `taskID` (`taskID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- export table eventmesh.event_mesh_verify structure
+CREATE TABLE IF NOT EXISTS `event_mesh_verify` (
+ `id` int unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `recordID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `recordSig` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `connectorName` varchar(200) COLLATE utf8_bin DEFAULT NULL,
+ `connectorStage` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `position` text COLLATE utf8_bin DEFAULT NULL,
+ `createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- eventmesh.event_mesh_weredis_position definition
+CREATE TABLE `event_mesh_weredis_position` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `jobID` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `address` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `clusterName` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `partitionName` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `masterReplid` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `host` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `replOffset` bigint(20) NOT NULL DEFAULT '-1',
+ `createTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `jobID` (`jobID`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC;
+
+
+CREATE TABLE `event_mesh_monitor` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `taskID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `jobID` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `address` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `transportType` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `connectorStage` varchar(50) COLLATE utf8_bin DEFAULT NULL,
+ `totalReqNum` bigint DEFAULT NULL,
+ `totalTimeCost` bigint DEFAULT NULL,
+ `maxTimeCost` bigint DEFAULT NULL,
+ `avgTimeCost` bigint DEFAULT NULL,
+ `tps` double DEFAULT NULL,
+ `createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
+/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
diff --git a/eventmesh-admin-server/conf/log4j2.xml b/eventmesh-admin-server/conf/log4j2.xml
new file mode 100644
index 0000000000..acc6acb8ba
--- /dev/null
+++ b/eventmesh-admin-server/conf/log4j2.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
new file mode 100644
index 0000000000..50e6ad82cc
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshDataSourceMapper.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,dataType,description,
+ configuration,configurationClass,region,
+ createUid,updateUid,createTime,updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
new file mode 100644
index 0000000000..a053d1c838
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshJobInfoMapper.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,jobID,jobDesc,
+ taskID,transportType,sourceData,
+ targetData,jobState,jobType,
+ fromRegion,runningRegion,createUid,
+ updateUid,createTime,updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml
new file mode 100644
index 0000000000..f77fb8ba77
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,jobID,address,transportType,connectorStage,
+ totalReqNum,totalTimeCost,maxTimeCost,avgTimeCost,
+ tps,createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
new file mode 100644
index 0000000000..9bcc7f42bb
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshMysqlPositionMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,jobID,serverUUID,
+ address,position,gtid,
+ currentGtid,timestamp,journalName,
+ createTime,updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
new file mode 100644
index 0000000000..a9e4fe6f1b
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshPositionReporterHistoryMapper.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,job,record,
+ address,createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
new file mode 100644
index 0000000000..200b1bf54a
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHeartbeatMapper.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,adminAddr,runtimeAddr,
+ jobID,reportTime,updateTime,
+ createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
new file mode 100644
index 0000000000..281cce30f9
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshRuntimeHistoryMapper.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,job,address,
+ createTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
new file mode 100644
index 0000000000..c3514fd945
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshTaskInfoMapper.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,taskName,
+ taskDesc,taskState,sourceRegion,targetRegion,
+ createUid,updateUid,createTime,
+ updateTime
+
+
diff --git a/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml b/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml
new file mode 100644
index 0000000000..45727498cc
--- /dev/null
+++ b/eventmesh-admin-server/conf/mapper/EventMeshVerifyMapper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,taskID,jobID,recordID,
+ recordSig,connectorName,connectorStage,
+ position,createTime
+
+
diff --git a/eventmesh-webhook/eventmesh-webhook-admin/gradle.properties b/eventmesh-admin-server/gradle.properties
similarity index 100%
rename from eventmesh-webhook/eventmesh-webhook-admin/gradle.properties
rename to eventmesh-admin-server/gradle.properties
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.java
new file mode 100644
index 0000000000..2e6d3c018a
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerProperties.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server;
+
+import java.util.Map;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@ConfigurationProperties("event-mesh.admin-server")
+@Getter
+@Setter
+public class AdminServerProperties {
+
+ private int port;
+ private boolean enableSSL;
+ private String configurationPath;
+ private String configurationFile;
+ private String serviceName;
+ private Map adminServerList;
+ private String region;
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
new file mode 100644
index 0000000000..e68d05100f
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/AdminServerRuntimeException.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server;
+
+import lombok.Getter;
+
+@Getter
+public class AdminServerRuntimeException extends RuntimeException {
+ private final int code;
+
+ public AdminServerRuntimeException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
new file mode 100644
index 0000000000..d0f2111041
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/ExampleAdminServer.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server;
+
+import org.apache.eventmesh.admin.server.constants.AdminServerConstants;
+import org.apache.eventmesh.common.config.ConfigService;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@SpringBootApplication(scanBasePackages = "org.apache.eventmesh.admin.server", exclude = {DataSourceAutoConfiguration.class})
+public class ExampleAdminServer {
+
+ public static void main(String[] args) throws Exception {
+ ConfigService.getInstance().setConfigPath(AdminServerConstants.EVENTMESH_CONF_HOME).setRootConfig(AdminServerConstants.EVENTMESH_CONF_FILE);
+ SpringApplication.run(ExampleAdminServer.class);
+ log.info("admin start success.");
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java
new file mode 100644
index 0000000000..8ed079fd31
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/constants/AdminServerConstants.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.constants;
+
+public class AdminServerConstants {
+ public static final String CONF_ENV = "configurationPath";
+
+ public static final String EVENTMESH_CONF_HOME = System.getProperty(CONF_ENV, System.getenv(CONF_ENV));
+
+ public static final String EVENTMESH_CONF_FILE = "eventmesh-admin.properties";
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java
new file mode 100644
index 0000000000..9bbe4ce305
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/BaseServer.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.web;
+
+import org.apache.eventmesh.common.ComponentLifeCycle;
+import org.apache.eventmesh.common.remote.payload.PayloadFactory;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class BaseServer implements ComponentLifeCycle {
+
+ static {
+ PayloadFactory.getInstance().init();
+ }
+
+ @PostConstruct
+ public void init() throws Exception {
+ log.info("[{}] server starting at port [{}]", this.getClass().getSimpleName(), getPort());
+ start();
+ log.info("[{}] server started at port [{}]", this.getClass().getSimpleName(), getPort());
+ }
+
+ @PreDestroy
+ public void shutdown() throws Exception {
+ log.info("[{}] server will destroy", this.getClass().getSimpleName());
+ stop();
+ log.info("[{}] server has be destroy", this.getClass().getSimpleName());
+ }
+
+ public abstract int getPort();
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
new file mode 100644
index 0000000000..d2a0330355
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/GrpcServer.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.web;
+
+import org.apache.eventmesh.admin.server.AdminServerProperties;
+import org.apache.eventmesh.admin.server.web.service.AdminGrpcServer;
+
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
+import io.grpc.Server;
+import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Controller
+@Slf4j
+public class GrpcServer extends BaseServer {
+
+ @Autowired
+ AdminGrpcServer adminGrpcServer;
+
+ @Autowired
+ AdminServerProperties properties;
+
+ private Server server;
+
+ @Override
+ public void start() throws Exception {
+ NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(getPort()).addService(adminGrpcServer);
+ if (properties.isEnableSSL()) {
+ serverBuilder.sslContext(null);
+ }
+ server = serverBuilder.build();
+ server.start();
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (server != null) {
+ server.shutdown();
+ if (!server.awaitTermination(30, TimeUnit.SECONDS)) {
+ log.warn("[{}] server don't graceful stop in 30s, it will shutdown now", this.getClass().getSimpleName());
+ server.shutdownNow();
+ }
+ }
+ } catch (InterruptedException e) {
+ log.warn("destroy [{}] server fail", this.getClass().getSimpleName(), e);
+ }
+ }
+
+ @Override
+ public int getPort() {
+ return properties.getPort();
+ }
+}
diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
new file mode 100644
index 0000000000..0a20d8645e
--- /dev/null
+++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.admin.server.web;
+
+import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
+import org.apache.eventmesh.admin.server.web.service.monitor.MonitorBizService;
+import org.apache.eventmesh.admin.server.web.service.task.TaskBizService;
+import org.apache.eventmesh.admin.server.web.service.verify.VerifyBizService;
+import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
+import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
+import org.apache.eventmesh.common.remote.request.QueryTaskMonitorRequest;
+import org.apache.eventmesh.common.remote.request.ReportMonitorRequest;
+import org.apache.eventmesh.common.remote.request.ReportVerifyRequest;
+import org.apache.eventmesh.common.remote.request.TaskBachRequest;
+import org.apache.eventmesh.common.remote.request.TaskIDRequest;
+import org.apache.eventmesh.common.remote.response.CreateTaskResponse;
+import org.apache.eventmesh.common.remote.response.HttpResponseResult;
+import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
+import org.apache.eventmesh.common.remote.response.QueryTaskMonitorResponse;
+import org.apache.eventmesh.common.remote.response.SimpleResponse;
+import org.apache.eventmesh.common.utils.JsonUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import lombok.extern.slf4j.Slf4j;
+
+@RestController
+@RequestMapping("/eventmesh/admin")
+@Slf4j
+public class HttpServer {
+
+ @Autowired
+ private TaskBizService taskService;
+
+ @Autowired
+ private VerifyBizService verifyService;
+
+ @Autowired
+ private MonitorBizService monitorService;
+
+ @Autowired
+ private EventMeshTaskInfoService taskInfoService;
+
+ @RequestMapping(value = "/createTask", method = RequestMethod.POST)
+ public String createOrUpdateTask(@RequestBody CreateTaskRequest task) {
+ log.info("receive http proto create task:{}", task);
+ CreateTaskResponse createTaskResponse = taskService.createTask(task);
+ log.info("receive http proto create task result:{}", createTaskResponse);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(createTaskResponse);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+
+ @RequestMapping(value = "/reportVerify", method = RequestMethod.POST)
+ public String reportVerify(@RequestBody ReportVerifyRequest request) {
+ log.info("receive http proto report verify request:{}", request);
+ boolean result = verifyService.reportVerifyRecord(request);
+ log.info("receive http proto report verify result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/reportMonitor", method = RequestMethod.POST)
+ public String reportMonitor(@RequestBody ReportMonitorRequest request) {
+ log.info("receive http proto report monitor request:{}", request);
+ boolean result = monitorService.reportMonitorRecord(request);
+ log.info("receive http proto report monitor result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/queryTaskMonitor", method = RequestMethod.POST)
+ public String queryTaskMonitor(@RequestBody QueryTaskMonitorRequest request) {
+ log.info("receive http proto query task monitor request:{}", request);
+ QueryTaskMonitorResponse result = monitorService.queryTaskMonitors(request);
+ log.info("receive http proto query task monitor result:{}", result);
+ SimpleResponse simpleResponse = new SimpleResponse();
+ simpleResponse.setData(result);
+ return JsonUtils.toJSONString(simpleResponse);
+ }
+
+ @RequestMapping(value = "/queryTaskInfo", method = RequestMethod.POST)
+ public HttpResponseResult