diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 0000000000..8bcc57a651
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,77 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+github:
+ description: EventMesh is a new generation serverless event middleware for building distributed event-driven applications.
+ homepage: https://eventmesh.apache.org/
+ labels:
+ - pubsub
+ - event-mesh
+ - event-gateway
+ - event-driven
+ - event-streaming
+ - event-sourcing
+ - event-governance
+ - event-connector
+ - cloud-native
+ - serverless
+ - serverless-workflow
+ - esb
+ - message-bus
+ - cqrs
+ - multi-runtime
+ - microservice
+ - hacktoberfest
+ enabled_merge_buttons:
+ squash: true
+ merge: false
+ rebase: false
+ protected_branches:
+ master:
+ required_status_checks:
+ strict: true
+ required_pull_request_reviews:
+ dismiss_stale_reviews: true
+ required_approving_review_count: 2
+ # Attempt to make the auto-generated github emails more easily readable in email clients.
+ custom_subjects:
+ new_pr: "[PR] {title} ({repository})"
+ close_pr: "Re: [PR] {title} ({repository})"
+ comment_pr: "Re: [PR] {title} ({repository})"
+ diffcomment: "Re: [PR] {title} ({repository})"
+ merge_pr: "Re: [PR] {title} ({repository})"
+ new_issue: "[I] {title} ({repository})"
+ comment_issue: "Re: [I] {title} ({repository})"
+ close_issue: "Re: [I] {title} ({repository})"
+ catchall: "[GH] {title} ({repository})"
+ new_discussion: "[D] {title} ({repository})"
+ edit_discussion: "Re: [D] {title} ({repository})"
+ close_discussion: "Re: [D] {title} ({repository})"
+ close_discussion_with_comment: "Re: [D] {title} ({repository})"
+ reopen_discussion: "Re: [D] {title} ({repository})"
+ new_comment_discussion: "Re: [D] {title} ({repository})"
+ edit_comment_discussion: "Re: [D] {title} ({repository})"
+ delete_comment_discussion: "Re: [D] {title} ({repository})"
+notifications:
+ commits: commits@eventmesh.apache.org
+ # Send all issue emails (new, closed, comments) to issues@
+ issues: issues@eventmesh.apache.org
+ # Send new/closed PR notifications to dev@
+ pullrequests_status: dev@eventmesh.apache.org
+ # Send individual PR comments/reviews to issues@
+ pullrequests_comment: issues@eventmesh.apache.org
+ jira_options: link label worklog
diff --git a/.coveralls.yml b/.coveralls.yml
deleted file mode 100644
index cf27a37024..0000000000
--- a/.coveralls.yml
+++ /dev/null
@@ -1 +0,0 @@
-service_name: travis-pro
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000..c0f64a8361
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+dist/
+build/
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..b27bb300d7
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+*.sh text eol=lf
+gradlew text eol=lf
+*.{cmd,[cC][mM][dD]} text eol=crlf
+*.{bat,[bB][aA][tT]} text eol=crlf
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000000..a19b99ed3d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,120 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: Bug report
+title: "[Bug] Bug title "
+description: If something isn't working as expected.
+labels: [ "bug" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: dropdown
+ attributes:
+ label: Environment
+ description: Describe the environment.
+ options:
+ - Mac
+ - Windows
+ - Linux
+ - Other
+ validations:
+ required: true
+
+ - type: dropdown
+ attributes:
+ label: EventMesh version
+ description: Describe the EventMesh version.
+ options:
+ - master
+ - 1.10.0
+ - 1.9.0
+ - 1.8.0
+ - 1.7.0
+ - 1.6.0
+ - 1.5.0
+ - 1.4.0
+ - 1.3.0
+ - 1.2.0
+ - Other
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: What happened
+ description: Describe what happened.
+ placeholder: >
+ A clear and concise description of what the bug is.
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: How to reproduce
+ description: >
+ Describe the steps to reproduce the bug here.
+ placeholder: >
+ Please make sure you provide a reproducible step-by-step case of how to reproduce the problem
+ as minimally and precisely as possible.
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Debug logs
+ description: Anything else we need to know?
+ placeholder: >
+ Add your debug logs here.
+ render: Java
+ validations:
+ required: false
+
+ - type: checkboxes
+ attributes:
+ label: Are you willing to submit PR?
+ description: >
+ This is absolutely not required, but we are happy to guide you in the contribution process
+ especially if you already have a good understanding of how to implement the fix.
+ options:
+ - label: Yes I am willing to submit a PR!
+
+ - type: checkboxes
+ attributes:
+ label: Code of Conduct
+ description: >
+ The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it..
+ options:
+ - label: I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) *
+
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/ISSUE_TEMPLATE/documentation_related.yml b/.github/ISSUE_TEMPLATE/documentation_related.yml
new file mode 100644
index 0000000000..1fa6ef875a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/documentation_related.yml
@@ -0,0 +1,68 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: Documentation Related
+title: "[Doc] Documentation Related "
+description: I find some issues related to the documentation.
+labels: [ "documentation" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Documentation Related
+ description: Describe the suggestion about document.
+ placeholder: >
+ e.g There is a typo
+ validations:
+ required: true
+
+ - type: checkboxes
+ attributes:
+ label: Are you willing to submit PR?
+ description: >
+ This is absolutely not required, but we are happy to guide you in the contribution process
+ especially if you already have a good understanding of how to implement the fix.
+ options:
+ - label: Yes I am willing to submit a PR!
+
+ - type: checkboxes
+ attributes:
+ label: Code of Conduct
+ description: >
+ The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it..
+ options:
+ - label: I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) *
+
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/ISSUE_TEMPLATE/enhancement_request.yml b/.github/ISSUE_TEMPLATE/enhancement_request.yml
new file mode 100644
index 0000000000..cd9e0c59ae
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/enhancement_request.yml
@@ -0,0 +1,77 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: Enhancement Request
+title: "[Enhancement] Enhancement title"
+description: I want to suggest an enhancement for this project
+labels: [ "enhancement" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Enhancement Request
+ description: Describe the suggestion.
+ placeholder: >
+ First of all: Have you checked the docs https://github.com/apache/eventmesh/tree/develop/docs,
+ or GitHub issues whether someone else has already reported your issue?
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Describe the solution you'd like
+ description: Describe the suggestion.
+ placeholder: >
+ A clear and concise description of what you want to happen. Add any considered drawbacks.
+ validations:
+ required: true
+
+ - type: checkboxes
+ attributes:
+ label: Are you willing to submit PR?
+ description: >
+ This is absolutely not required, but we are happy to guide you in the contribution process
+ especially if you already have a good understanding of how to implement the fix.
+ options:
+ - label: Yes I am willing to submit a PR!
+
+ - type: checkboxes
+ attributes:
+ label: Code of Conduct
+ description: >
+ The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it..
+ options:
+ - label: I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) *
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000000..fe9d032068
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -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.
+#
+
+name: Feature Request
+title: "[Feature] Feature title "
+description: I want to suggest a feature for this project.
+labels: [ "feature" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Feature Request
+ description: Describe the feature.
+ placeholder: >
+ First of all: Have you checked the docs https://github.com/apache/eventmesh/tree/develop/docs,
+ or GitHub issues whether someone else has already reported your issue?
+ Maybe the feature already exists?
+ validations:
+ required: true
+
+ - type: checkboxes
+ attributes:
+ label: Are you willing to submit PR?
+ description: >
+ This is absolutely not required, but we are happy to guide you in the contribution process
+ especially if you already have a good understanding of how to implement the fix.
+ options:
+ - label: Yes I am willing to submit a PR!
+
+ - type: checkboxes
+ attributes:
+ label: Code of Conduct
+ description: >
+ The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it..
+ options:
+ - label: I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) *
+
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml
new file mode 100644
index 0000000000..bd39533a10
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/question.yml
@@ -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.
+#
+
+name: Question
+title: "[Question] Question title "
+description: I have a question that isn't answered in docs or issue.
+labels: [ "question" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Question
+ description: Describe your question.
+ placeholder: >
+ Describe your question here :D
+ validations:
+ required: true
+
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/ISSUE_TEMPLATE/unit_test.yml b/.github/ISSUE_TEMPLATE/unit_test.yml
new file mode 100644
index 0000000000..82ce502400
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/unit_test.yml
@@ -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.
+#
+
+name: Unit Test
+title: "[Unit Test] Unit test title"
+description: I want to do some unit tests for this project
+labels: [ "testing" ]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ For better global communication, Please write in English.
+
+ - type: checkboxes
+ attributes:
+ label: Search before asking
+ description: >
+ Please make sure to search in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue)
+ first to see whether the same issue was reported already.
+ options:
+ - label: >
+ I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found
+ no similar issues.
+ required: true
+
+ - type: checkboxes
+ attributes:
+ label: Read the unit testing guidelines
+ description: >
+ Read the [unit testing guidelines](https://eventmesh.apache.org/community/contribute/write-unit-test) before writing unit test code.
+ options:
+ - label: >
+ I have read.
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Unit test request
+ description: Describe the unit test.
+ placeholder: >
+ First of all: Have you checked the docs https://github.com/apache/eventmesh/tree/develop/docs,
+ or GitHub issues whether someone else has already reported your issue?
+ Maybe the unit tests you want to do have already been done?
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Describe the unit tests you want to do
+ description: Describe the unit test.
+ value: |
+ Module name:
+ Located at:
+ Task status: ×(unfinished) / √(finished)
+ | Task Status | Class | Type |
+ | :------: | :------ | :------ |
+ | × | xxxxxx | xxxxxx |
+ validations:
+ required: true
+
+ - type: checkboxes
+ attributes:
+ label: Are you willing to submit PR?
+ description: >
+ This is absolutely not required, but we are happy to guide you in the contribution process
+ especially if you already have a good understanding of how to implement the fix.
+ options:
+ - label: Yes I am willing to submit a PR!
+
+ - type: markdown
+ attributes:
+ value: "Thanks for completing our form!"
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000..428cda5f55
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,42 @@
+
+
+
+
+Fixes #issue_id
+
+### Motivation
+
+*Explain the content here.*
+*Explain why you want to make the changes and what problem you're trying to solve.*
+
+### Modifications
+
+*Describe the modifications you've done.*
+
+### Documentation
+
+- Does this pull request introduce a new feature? (yes / no)
+- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
+- If a feature is not applicable for documentation, explain why?
+- If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000000..fec01fab24
--- /dev/null
+++ b/.github/dependabot.yml
@@ -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.
+#
+
+version: 2
+updates:
+ - package-ecosystem: "gradle"
+ directory: "/"
+ open-pull-requests-limit: 20
+ schedule:
+ interval: "weekly"
+ ignore:
+ - dependency-name: "*"
+ update-types: ["version-update:semver-major"]
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000000..e6018573c6
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,101 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: "Continuous Integration"
+
+on:
+ push:
+ branches: [ '*' ]
+ pull_request:
+ branches: [ '*' ]
+
+jobs:
+ build:
+ name: Build
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ ubuntu-latest, macOS-latest ]
+ java: [ 8, 11 ]
+ language: ['java']
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - 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: Setup Gradle
+ uses: gradle/gradle-build-action@v2
+
+ - name: Set up JDK 11
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 11
+
+ - name: GenerateGrammarSource
+ run: ./gradlew clean generateGrammarSource --parallel --daemon
+ env:
+ GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+
+ - name: Set up JDK ${{ matrix.java }}
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: ${{ matrix.java }}
+
+ # https://docs.gradle.org/current/userguide/performance.html
+ - name: Build
+ run: ./gradlew clean build dist jacocoTestReport -x spotlessJava -x generateGrammarSource --parallel --daemon
+ env:
+ GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+
+ - name: Install plugin
+ run: ./gradlew installPlugin
+ env:
+ GRADLE_ENTERPRISE_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!'
+
+ license-check:
+ name: License Check
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Check license header
+ uses: apache/skywalking-eyes@main
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check third party dependencies
+ run: |
+ ./gradlew clean dist -x spotlessJava -x test -x checkstyleMain -x javaDoc && ./gradlew installPlugin && ./gradlew tar && sh tools/dependency-check/check-dependencies.sh && echo "Thirty party dependencies check success"
+ env:
+ GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000000..d8a345a39f
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -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.
+#
+
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ '*' ]
+ pull_request:
+ branches: [ '*' ]
+
+jobs:
+ build:
+ name: Analyze
+ strategy:
+ fail-fast: false
+ matrix:
+ language: ['java', 'go']
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
+ languages: ${{ matrix.language }}
+
+ - name: Setup Gradle
+ uses: gradle/gradle-build-action@v2
+ if: matrix.language == 'java'
+
+ - name: Set up JDK 11
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 11
+ if: matrix.language == 'java'
+
+ # https://docs.gradle.org/current/userguide/performance.html
+ - name: Build
+ run: ./gradlew clean assemble compileTestJava --no-build-cache --parallel --daemon
+ env:
+ GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
+ if: matrix.language == 'java'
+
+ - name: Perform CodeQL analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml
new file mode 100644
index 0000000000..ab49c8204e
--- /dev/null
+++ b/.github/workflows/docker.yaml
@@ -0,0 +1,49 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: Docker
+on:
+ release:
+ types: [released]
+
+jobs:
+ docker:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+ - name: Login to DockerHub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USER }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v4
+ with:
+ images: |
+ apache/eventmesh
+
+ - name: Build and push
+ uses: docker/build-push-action@v4
+ with:
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ file: ./docker/Dockerfile_jdk8
+ context: ./
diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml
new file mode 100644
index 0000000000..740ea6a246
--- /dev/null
+++ b/.github/workflows/greetings.yml
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: Greetings
+
+on: [pull_request_target, issues]
+
+jobs:
+ greeting:
+ name: Greeting
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/first-interaction@v1.3.0
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ issue-message: |
+ Welcome to the Apache EventMesh community!!
+ We are glad that you are contributing by opening this issue. :D
+
+ Please make sure to include all the relevant context.
+ We will be here shortly.
+
+ If you are interested in contributing to our project, please let us know!
+ You can check out our contributing guide on [contributing to EventMesh](https://eventmesh.apache.org/community/contribute/contribute).
+
+ Want to get closer to the community?
+
+ |WeChat Assistant|WeChat Public Account|Slack|
+ |-|-|-|
+ |||[Join Slack Chat](https://join.slack.com/t/the-asf/shared_invite/zt-1y375qcox-UW1898e4kZE_pqrNsrBM2g)|
+
+ Mailing Lists:
+ | Name | Description |Subscribe |Unsubscribe|Archive
+ | ---- | ---- |---- | ---- | ---- |
+ |Users |User support and questions mailing list| [Subscribe](mailto:users-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:users-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?users@eventmesh.apache.org)|
+ |Development |Development related discussions| [Subscribe](mailto:dev-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:dev-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?dev@eventmesh.apache.org)|
+ |Commits |All commits to repositories| [Subscribe](mailto:commits-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:commits-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?commits@eventmesh.apache.org)|
+ |Issues |Issues or PRs comments and reviews| [Subscribe](mailto:commits-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:commits-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?commits@eventmesh.apache.org)|
+
+ pr-message: |
+ Welcome to the Apache EventMesh community!!
+ This is your first PR in our project. We're very excited to have you onboard contributing. Your contributions are greatly appreciated!
+
+ Please make sure that the changes are covered by tests.
+ We will be here shortly.
+ Let us know if you need any help!
+
+ Want to get closer to the community?
+
+ |WeChat Assistant|WeChat Public Account|Slack|
+ |-|-|-|
+ |||[Join Slack Chat](https://join.slack.com/t/the-asf/shared_invite/zt-1y375qcox-UW1898e4kZE_pqrNsrBM2g)|
+
+ Mailing Lists:
+ | Name | Description |Subscribe |Unsubscribe|Archive
+ | ---- | ---- |---- | ---- | ---- |
+ |Users |User support and questions mailing list| [Subscribe](mailto:users-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:users-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?users@eventmesh.apache.org)|
+ |Development |Development related discussions| [Subscribe](mailto:dev-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:dev-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?dev@eventmesh.apache.org)|
+ |Commits |All commits to repositories| [Subscribe](mailto:commits-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:commits-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?commits@eventmesh.apache.org)|
+ |Issues |Issues or PRs comments and reviews| [Subscribe](mailto:commits-subscribe@eventmesh.incubator.apache.org) |[Unsubscribe](mailto:commits-unsubscribe@eventmesh.incubator.apache.org) |[Mail Archives](https://lists.apache.org/list.html?commits@eventmesh.apache.org)|
diff --git a/.gitignore b/.gitignore
index 936bb5cb18..a22c82f795 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,11 +9,45 @@ logs
*.iws
*.class
*.log
+*.log.*
.idea
+!/.idea/icon.png
build
.classpath
.project
test-output
dist
+out
.pmd
classes
+package-lock.json
+node_modules
+.run
+
+h2/db.mv.db
+
+# license check tmp file
+all-dependencies.txt
+self-modules.txt
+third-party-dependencies.txt
+
+# github codespaces or visual studio
+.vscode
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+**/org/apache/eventmesh/connector/jdbc/antlr4/autogeneration/*
+
+#rust
+Cargo.lock
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..51d401af7f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,7 @@
+[submodule "eventmesh-sdks/eventmesh-sdk-c/third_party/json-c"]
+ path = eventmesh-sdks/eventmesh-sdk-c/third_party/json-c
+ url = git@github.com:json-c/json-c.git
+ branch = json-c-0.17
+[submodule "eventmesh-sdks/eventmesh-sdk-c/third_party/curl"]
+ path = eventmesh-sdks/eventmesh-sdk-c/third_party/curl
+ url = git@github.com:curl/curl.git
diff --git a/.idea/icon.png b/.idea/icon.png
new file mode 100644
index 0000000000..59aa06dac9
Binary files /dev/null and b/.idea/icon.png differ
diff --git a/.licenserc.yaml b/.licenserc.yaml
new file mode 100644
index 0000000000..61d0621403
--- /dev/null
+++ b/.licenserc.yaml
@@ -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.
+#
+
+header:
+ license:
+ spdx-id: Apache-2.0
+ copyright-owner: Apache Software Foundation
+
+ paths-ignore:
+ - 'eventmesh-operator/config/crd/bases'
+ - 'eventmesh-operator/config/rbac'
+ - '.github/PULL_REQUEST_TEMPLATE'
+ - '.gitmodules'
+ - '**/.gitkeep'
+ - '**/.gitignore'
+ - '**/.dockerignore'
+ - '**/*.md'
+ - '**/*.json'
+ - '**/*.ftl'
+ - '**/*.iml'
+ - '**/*.ini'
+ - '**/*.crt'
+ - '**/*.pem'
+ - '**/go.sum'
+ - '**/Cargo.lock'
+ - 'LICENSE'
+ - 'NOTICE'
+ - 'DISCLAIMER'
+ - 'gradlew'
+ - 'gradlew.bat'
+ - '**/*.txt'
+ - 'DISCLAIMER'
+
+ comment: on-failure
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 4c2ba8ba57..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-dist: trusty
-
-language: java
-jdk:
-- oraclejdk8
-
-script:
-- travis_retry gradle check
-
-after_success:
-- gradle clean test jacocoAllTestReport coveralls
-
-env:
- global:
- - secure: "T1QAuaAzcB7K8YjAAVVb4P9+W0JAdOFbyBwRxliyyoSZUShlIqa0eE7ioXHXWBP/d5f3XtROse6lq2qILqcU9sFSncKE2vRJlwJ5p7R23WIsCXdV70A9AVE2gLJcIJiOTMwd/YYYzNDrGLp3CSJNcKo8t7t70V2j/11I9xPTOHnaZ8FHGC3d/7bjfR/+g/3d4EOCvV8Vm6ndEmmailmF8OJ/kcbuRbArKIehjUwNDyQZfwAc9+vvPZlHgnQvR1pJ/KiK6muEIi7RQohDq7lMTmcc2LZSYgy/+aqFrmBcQwXScABFmSwysQ4KMXfrCqqMsBdmvno/NoKVGofHHKdym/oauv/G3lxLx5sgM9A7ZSFBK08x08r7u/6TDsTFmQ9LzVFDNo/OLZhxs3dr9x2C9Pa2A7IP1i1oVbbYkwBJv4z6o3khWpQAAY/IWijlCZ9vkjFfqdIXbvlPqamEaFRAmK5I3MVqL2+eBF+2Or/zwv4rXjo+v5LUKTfmDl77QUshPv6J+hblbBR0cJ/ZTSh9rHgdqhEzPGSt3e0YrEefkKWfinBr8TjIsHgQgmfU8Kz7gf7tvioOuAgKj4WlgEQJs3dPp7J5zxFVNMM6teAMFy8c2MtAdzKrs13Ri1qZWtL6B7JWlH6yhHqhKghyJhRjUFNVZnBkA/z9gzDKZ+tz2m8="
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index c03c59a0bc..0000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,68 +0,0 @@
-# Contributing to EventMesh
-
-Welcome to EventMesh! This document is a guideline about how to contribute to EventMesh.
-If you find something incorrect or missing, please leave comments / suggestions.
-
-## Before you get started
-
-### Setting up your development environment
-
-You should have JDK installed in your operating system.
-
-## Contributing
-
-We are always very happy to have contributions, whether for typo fix, bug fix or big new features.
-Please do not ever hesitate to ask a question or send a pull request.
-
-We strongly value documentation and integration with other projects.
-We are very glad to accept improvements for these aspects.
-
-### GitHub workflow
-
-We use the `develop` branch as the development branch, which indicates that this is an unstable branch.
-
-Here are the workflow for contributors:
-
-1. Fork to your own
-2. Clone fork to local repository
-3. Create a new branch and work on it
-4. Keep your branch in sync
-5. Commit your changes (make sure your commit message concise)
-6. Push your commits to your forked repository
-7. Create a pull request
-
-Please follow [the pull request template](./.github/PULL_REQUEST_TEMPLATE.md).
-Please make sure the PR has a corresponding issue.
-
-After creating a PR, one or more reviewers will be assigned to the pull request.
-The reviewers will review the code.
-
-Before merging a PR, squash any fix review feedback, typo, merged, and rebased sorts of commits.
-The final commit message should be clear and concise.
-
-### Open an issue / PR
-
-We use [GitHub Issues](https://github.com/WeBankFinTech/EventMesh/issues) and [Pull Requests](https://github.com/WeBankFinTech/EventMesh/pulls) for trackers.
-
-If you find a typo in a document, find a bug in code, or want new features, or want to give suggestions,
-you can [open an issue on GitHub](https://github.com/WeBankFinTech/EventMesh/issues/new) to report it.
-Please follow the guideline message in the issue template.
-
-If you want to contribute, please follow the [contribution workflow](#github-workflow) and create a new pull request.
-If your PR contains large changes, e.g. component refactor or new components, please write detailed documents
-about its design and usage.
-
-Note that a single pull request should not be too large. If heavy changes are required, it's better to separate the changes
-to a few individual PRs.
-
-### Code review
-
-All code should be well reviewed by one or more committers. Some principles:
-
-- Readability: Important code should be well-documented. Comply with our code style.
-- Elegance: New functions, classes or components should be well-designed.
-- Testability: Important code should be well-tested (high unit test coverage).
-
-## Community
-
-### Contact us
diff --git a/DISCLAIMER b/DISCLAIMER
new file mode 100644
index 0000000000..7721588e3e
--- /dev/null
+++ b/DISCLAIMER
@@ -0,0 +1,19 @@
+Apache EventMesh is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure,
+communications, and decision-making process have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code,
+it does indicate that the project has yet to be fully endorsed by the ASF.
+
+Some of the project’s releases may not be fully compliant with ASF policy.
+For example, releases may have incomplete or un-reviewed licensing conditions.
+What follows is a list of issues the project is currently aware of (this list is likely to be incomplete):
+
+1- Releases may have incomplete licensing conditions
+
+
+If you are planning to incorporate this work into your product/project,
+please be aware that you will need to conduct a thorough licensing review to determine the overall implications of including this work.
+For the current status of this project through the Apache Incubator, visit: https://incubator.apache.org/projects/eventmesh.html
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..261eeb9e9f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000000..910ee0673f
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,5 @@
+Apache EventMesh
+Copyright 2021-2024 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.md b/README.md
index 1d59312312..ca3ae0bf4b 100644
--- a/README.md
+++ b/README.md
@@ -1,42 +1,227 @@
-[](https://www.travis-ci.org/WeBankFinTech/EventMesh) [](https://coveralls.io/github/WeBankFinTech/EventMesh?branch=master)
+
-## What is an Event Mesh?
-This diagram shows where an event mesh fits in an application stack relative to other technologies such as service mesh:
-
+
+
+
-An event mesh is a configurable and dynamic infrastructure layer for distributing events among decoupled applications, cloud services and devices. It enables event communications to be governed, flexible, reliable and fast. An event mesh is created and enabled through a network of interconnected event meshers.
+[](https://github.com/apache/eventmesh/actions/workflows/ci.yml)
+[](https://codecov.io/gh/apache/eventmesh)
+[](https://lgtm.com/projects/g/apache/eventmesh/context:java)
+[](https://lgtm.com/projects/g/apache/eventmesh/alerts/)
-## What are the core capabilities of an event mesh?
-This diagram shows the architecture of EventMesh:
-
+[](https://www.apache.org/licenses/LICENSE-2.0.html)
+[](https://github.com/apache/eventmesh/releases)
+[](https://join.slack.com/t/the-asf/shared_invite/zt-1y375qcox-UW1898e4kZE_pqrNsrBM2g)
+
-An event mesh allows events from one application to be dynamically routed and received by any other application no matter where these applications are deployed (no cloud, private cloud, public cloud).
-The generic capabilities of an event mesh:
-* inherently ‘event-driven;’
-* created by connecting event meshers;
-* environment agnostic (can be deployed anywhere); and,
-* dynamic.
+[📦 Documentation](https://eventmesh.apache.org/docs/introduction) |
+[📔 Examples](https://github.com/apache/eventmesh/tree/master/eventmesh-examples) |
+[⚙️ Roadmap](https://eventmesh.apache.org/docs/roadmap) |
+[🌐 简体中文](README.zh-CN.md)
+
-Key components:
-* eventmesh-emesher : an middleware to transmit events between event producers and consumers, support cloud native apps and microservices
-* eventmesh-sdk-java : support for popular open standard protocols and APIs, including REST/HTTP, AMQP, MQTT, Websocket and JMS, gRPC etc.
-* eventmesh-registry : automatically routes events between applications and services connected to seperate event meshers
-* eventmesh-governance : governace layer for event producers and consumers
-* eventmesh-acl : security at various level of authentication, authorization and topic/channel access control
-* eventmesh-store : the store layer of Event-Mesh which implemented with [DeFiBus](https://github.com/WeBankFinTech/DeFiBus)(based on RocketMQ in financial scenario) or RocketMQ by default. We wish the store layeris a general solution and can use any store implement such as kafka, redis ,blockchain etc.
-## Quick Start
-Coming soon...
+# Apache EventMesh
+
+**Apache EventMesh** is a new generation serverless event middleware for building distributed [event-driven](https://en.wikipedia.org/wiki/Event-driven_architecture) applications.
+
+### EventMesh Architecture
+
+
+
+### EventMesh Dashboard
+
+
+
+## Features
+
+Apache EventMesh has a vast amount of features to help users achieve their goals. Let us share with you some of the key features EventMesh has to offer:
+
+- Built around the [CloudEvents](https://cloudevents.io) specification.
+- Rapidty extendsible interconnector layer [connectors](https://github.com/apache/eventmesh/tree/master/eventmesh-connectors) using [openConnect](https://github.com/apache/eventmesh/tree/master/eventmesh-openconnect) such as the source or sink of Saas, CloudService, and Database etc.
+- Rapidty extendsible storage layer such as [Apache RocketMQ](https://rocketmq.apache.org), [Apache Kafka](https://kafka.apache.org), [Apache Pulsar](https://pulsar.apache.org), [RabbitMQ](https://rabbitmq.com), [Redis](https://redis.io).
+- Rapidty extendsible meta such as [Consul](https://consulproject.org/en/), [Nacos](https://nacos.io), [ETCD](https://etcd.io) and [Zookeeper](https://zookeeper.apache.org/).
+- Guaranteed at-least-once delivery.
+- Deliver events between multiple EventMesh deployments.
+- Event schema management by catalog service.
+- Powerful event orchestration by [Serverless workflow](https://serverlessworkflow.io/) engine.
+- Powerful event filtering and transformation.
+- Rapid, seamless scalability.
+- Easy Function develop and framework integration.
+
+## Roadmap
+
+Please go to the [roadmap](https://eventmesh.apache.org/docs/roadmap) to get the release history and new features of Apache EventMesh.
+
+## Subprojects
+
+- [EventMesh-site](https://github.com/apache/eventmesh-site): Apache official website resources for EventMesh.
+- [EventMesh-workflow](https://github.com/apache/eventmesh-workflow): Serverless workflow runtime for event Orchestration on EventMesh.
+- [EventMesh-dashboard](https://github.com/apache/eventmesh-dashboard): Operation and maintenance console of EventMesh.
+- [EventMesh-catalog](https://github.com/apache/eventmesh-catalog): Catalog service for event schema management using AsyncAPI.
+- [EventMesh-go](https://github.com/apache/eventmesh-go): A go implementation for EventMesh runtime.
+
+## Quick start
+
+This section of the guide will show you the steps to deploy EventMesh from [Local](#run-eventmesh-runtime-locally), [Docker](#run-eventmesh-runtime-in-docker), [K8s](#run-eventmesh-runtime-in-kubernetes).
+
+This section guides the launch of EventMesh according to the default configuration, if you need more detailed EventMesh deployment steps, please visit the [EventMesh official document](https://eventmesh.apache.org/docs/introduction).
+
+### Deployment Event Store
+
+> EventMesh supports [multiple Event Stores](https://eventmesh.apache.org/docs/roadmap#event-store-implementation-status), the default storage mode is `standalone`, and does not rely on other event stores as layers.
+
+### Run EventMesh Runtime locally
+
+#### 1. Download EventMesh
+
+Download the latest version of the Binary Distribution from the [EventMesh Download](https://eventmesh.apache.org/download/) page and extract it:
+
+```shell
+wget https://dlcdn.apache.org/eventmesh/1.10.0/apache-eventmesh-1.10.0-bin.tar.gz
+tar -xvzf apache-eventmesh-1.10.0-bin.tar.gz
+cd apache-eventmesh-1.10.0
+```
+
+#### 2. Run EventMesh
+
+Execute the `start.sh` script to start the EventMesh Runtime server.
+
+```shell
+bash bin/start.sh
+```
+
+View the output log:
+
+```shell
+tail -n 50 -f logs/eventmesh.out
+```
+
+When the log output shows server `state:RUNNING`, it means EventMesh Runtime has started successfully.
+
+You can stop the run with the following command:
+
+```shell
+bash bin/stop.sh
+```
+
+When the script prints `shutdown server ok!`, it means EventMesh Runtime has stopped.
+
+### Run EventMesh Runtime in Docker
+
+#### 1. Pull EventMesh Image
+
+Use the following command line to download the latest version of [EventMesh](https://hub.docker.com/r/apache/eventmesh):
+
+```shell
+sudo docker pull apache/eventmesh:latest
+```
+
+#### 2. Run and Manage EventMesh Container
+
+Use the following command to start the EventMesh container:
+
+```shell
+sudo docker run -d --name eventmesh -p 10000:10000 -p 10105:10105 -p 10205:10205 -p 10106:10106 -t apache/eventmesh:latest
+```
+
+
+Enter the container:
+
+```shell
+sudo docker exec -it eventmesh /bin/bash
+```
+
+view the log:
+
+```shell
+cd logs
+tail -n 50 -f eventmesh.out
+```
+
+### Run EventMesh Runtime in Kubernetes
+
+#### 1. Deploy operator
+
+Run the following commands(To delete a deployment, simply replace `deploy` with `undeploy`):
+
+```shell
+$ cd eventmesh-operator && make deploy
+```
+
+Run `kubectl get pods` 、`kubectl get crd | grep eventmesh-operator.eventmesh`to see the status of the deployed eventmesh-operator.
+
+```shell
+$ kubectl get pods
+NAME READY STATUS RESTARTS AGE
+eventmesh-operator-59c59f4f7b-nmmlm 1/1 Running 0 20s
+
+$ kubectl get crd | grep eventmesh-operator.eventmesh
+connectors.eventmesh-operator.eventmesh 2024-01-10T02:40:27Z
+runtimes.eventmesh-operator.eventmesh 2024-01-10T02:40:27Z
+```
+
+#### 2. Deploy EventMesh Runtime
+
+Execute the following command to deploy runtime, connector-rocketmq (To delete, simply replace `create` with `delete`):
+
+```shell
+$ make create
+```
+
+Run `kubectl get pods` to see if the deployment was successful.
+
+```shell
+NAME READY STATUS RESTARTS AGE
+connector-rocketmq-0 1/1 Running 0 9s
+eventmesh-operator-59c59f4f7b-nmmlm 1/1 Running 0 3m12s
+eventmesh-runtime-0-a-0 1/1 Running 0 15s
+```
## Contributing
-Contributions are always welcomed! Please see [CONTRIBUTING](CONTRIBUTING.md) for detailed guidelines.
-You can start with the issues labeled with good first issue.
+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
+
+
-
-广播模式下,监听此topic的每个消费组中的每个实例都需要收到消息。
\ No newline at end of file
diff --git a/docs/cn/quickstart.md b/docs/cn/quickstart.md
deleted file mode 100644
index bcff7fc088..0000000000
--- a/docs/cn/quickstart.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Quick start Instarction
-
-### dependencies
-```
-64bit OS, Linux/Unix/Mac is recommended;
-64bit JDK 1.8+;
-Gradle 3.x;
-4g+ free disk for Broker server
-```
-
-### download and build
-
-```
-download from git
-unzip defibus-master.zip
-cd defibus-master
-gradle clean dist tar -x test
-
-You can get a tar.gz package in directory named 'build'
-```
-
-### Deployment
-
-deploy DeFiBusNamesrv
-```
-tar -zxvf DeFiBus_1.0.0.tar.gz
-cd bin
-sh runnamesrv.sh
-```
-
-deploy DeFiBusBroker
-```
-tar -zxvf DeFiBus_1.0.0.tar.gz
-cd bin
-sh runbroker.sh
-```
diff --git a/docs/en/features/architecture.md b/docs/en/features/architecture.md
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/docs/en/features/request-response-call.md b/docs/en/features/request-response-call.md
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/docs/images/eventmesh-arch.png b/docs/images/eventmesh-arch.png
deleted file mode 100644
index 55ce5ddbb6..0000000000
Binary files a/docs/images/eventmesh-arch.png and /dev/null differ
diff --git a/docs/images/eventmesh-define.png b/docs/images/eventmesh-define.png
deleted file mode 100644
index f0c62d1b4d..0000000000
Binary files a/docs/images/eventmesh-define.png and /dev/null differ
diff --git a/docs/images/features/RR-call-p1.png b/docs/images/features/RR-call-p1.png
deleted file mode 100644
index 2232df3e1f..0000000000
Binary files a/docs/images/features/RR-call-p1.png and /dev/null differ
diff --git a/docs/images/features/a-distributing-architecture-in-financial-EN.png b/docs/images/features/a-distributing-architecture-in-financial-EN.png
deleted file mode 100644
index 7e7b3d7f8d..0000000000
Binary files a/docs/images/features/a-distributing-architecture-in-financial-EN.png and /dev/null differ
diff --git a/docs/images/features/a-distributing-architecture-in-financial.png b/docs/images/features/a-distributing-architecture-in-financial.png
deleted file mode 100644
index d7eeb9d246..0000000000
Binary files a/docs/images/features/a-distributing-architecture-in-financial.png and /dev/null differ
diff --git a/docs/images/features/adjust-queue-expand-p1.png b/docs/images/features/adjust-queue-expand-p1.png
deleted file mode 100644
index 2660f3139b..0000000000
Binary files a/docs/images/features/adjust-queue-expand-p1.png and /dev/null differ
diff --git a/docs/images/features/adjust-queue-shrink-p1.png b/docs/images/features/adjust-queue-shrink-p1.png
deleted file mode 100644
index e4dc500f96..0000000000
Binary files a/docs/images/features/adjust-queue-shrink-p1.png and /dev/null differ
diff --git a/docs/images/features/architecture-p1.png b/docs/images/features/architecture-p1.png
deleted file mode 100644
index cda0b0433a..0000000000
Binary files a/docs/images/features/architecture-p1.png and /dev/null differ
diff --git a/docs/images/features/broadcast.png b/docs/images/features/broadcast.png
deleted file mode 100644
index 2cf528d988..0000000000
Binary files a/docs/images/features/broadcast.png and /dev/null differ
diff --git a/docs/images/features/circuit-break-p1.png b/docs/images/features/circuit-break-p1.png
deleted file mode 100644
index b3f55f75cd..0000000000
Binary files a/docs/images/features/circuit-break-p1.png and /dev/null differ
diff --git a/docs/images/features/dark-launch-p1.png b/docs/images/features/dark-launch-p1.png
deleted file mode 100644
index 08c04430b6..0000000000
Binary files a/docs/images/features/dark-launch-p1.png and /dev/null differ
diff --git a/docs/images/features/invoke_nearby-p1.png b/docs/images/features/invoke_nearby-p1.png
deleted file mode 100644
index 2aa0afe961..0000000000
Binary files a/docs/images/features/invoke_nearby-p1.png and /dev/null differ
diff --git a/docs/images/features/multicast.png b/docs/images/features/multicast.png
deleted file mode 100644
index 9643044457..0000000000
Binary files a/docs/images/features/multicast.png and /dev/null differ
diff --git a/docs/images/features/subscribe-nearby-p1.png b/docs/images/features/subscribe-nearby-p1.png
deleted file mode 100644
index d3a141922f..0000000000
Binary files a/docs/images/features/subscribe-nearby-p1.png and /dev/null differ
diff --git a/docs/images/features/tongchengduohuo-p1.png b/docs/images/features/tongchengduohuo-p1.png
deleted file mode 100644
index 663186ae1c..0000000000
Binary files a/docs/images/features/tongchengduohuo-p1.png and /dev/null differ
diff --git a/docs/images/features/unicast.png b/docs/images/features/unicast.png
deleted file mode 100644
index 1be62694eb..0000000000
Binary files a/docs/images/features/unicast.png and /dev/null differ
diff --git a/docs/images/qqgroup-crcode.png b/docs/images/qqgroup-crcode.png
deleted file mode 100644
index 10ca3c2aeb..0000000000
Binary files a/docs/images/qqgroup-crcode.png and /dev/null differ
diff --git a/docs/images/wechat_helper.png b/docs/images/wechat_helper.png
deleted file mode 100644
index 35c21a3f98..0000000000
Binary files a/docs/images/wechat_helper.png and /dev/null differ
diff --git a/eventmesh-acl/build.gradle b/eventmesh-acl/build.gradle
deleted file mode 100644
index 11bbc47bf2..0000000000
--- a/eventmesh-acl/build.gradle
+++ /dev/null
@@ -1,14 +0,0 @@
-plugins {
- id 'java'
-}
-
-group 'cn.webank.defibus'
-version '1.0.0'
-
-repositories {
- mavenCentral()
-}
-
-dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.12'
-}
diff --git a/eventmesh-common/build.gradle b/eventmesh-common/build.gradle
new file mode 100644
index 0000000000..fd7a6e1ee6
--- /dev/null
+++ b/eventmesh-common/build.gradle
@@ -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.
+ */
+
+def grpcVersion = '1.43.2'
+
+dependencies {
+ api "com.google.guava:guava"
+ api "org.slf4j:slf4j-api"
+ api "org.assertj:assertj-core"
+ api "org.apache.commons:commons-collections4"
+ api "org.apache.commons:commons-text"
+ api "org.apache.commons:commons-lang3"
+
+ api "com.jayway.jsonpath:json-path"
+
+ api "io.cloudevents:cloudevents-core"
+ api "io.cloudevents:cloudevents-json-jackson"
+
+ implementation "org.apache.logging.log4j:log4j-api"
+ implementation "org.apache.logging.log4j:log4j-core"
+ implementation "org.apache.logging.log4j:log4j-slf4j2-impl"
+
+ implementation 'com.github.seancfoley:ipaddress'
+
+ implementation "com.lmax:disruptor"
+
+ api "com.fasterxml.jackson.core:jackson-databind"
+ api "com.fasterxml.jackson.core:jackson-core"
+ api "com.fasterxml.jackson.core:jackson-annotations"
+ api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
+
+ implementation "org.apache.httpcomponents:httpclient"
+
+ implementation "io.netty:netty-all"
+
+ implementation "io.grpc:grpc-protobuf:${grpcVersion}"
+ implementation "io.grpc:grpc-stub:${grpcVersion}"
+ implementation "javax.annotation:javax.annotation-api:1.3.2"
+
+ testImplementation "org.junit-pioneer:junit-pioneer"
+ implementation "org.yaml:snakeyaml"
+
+ compileOnly 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+
+ testCompileOnly 'org.projectlombok:lombok'
+ testAnnotationProcessor 'org.projectlombok:lombok'
+
+ testImplementation "org.apache.commons:commons-lang3"
+
+ testImplementation "com.google.guava:guava"
+
+ testImplementation "org.slf4j:slf4j-api"
+ testImplementation "org.apache.logging.log4j:log4j-api"
+ testImplementation "org.apache.logging.log4j:log4j-core"
+ testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl"
+
+ testImplementation "com.lmax:disruptor"
+
+ testImplementation "com.fasterxml.jackson.core:jackson-databind"
+ testImplementation "com.fasterxml.jackson.core:jackson-core"
+ testImplementation "com.fasterxml.jackson.core:jackson-annotations"
+
+ testImplementation "org.apache.httpcomponents:httpclient"
+
+ testImplementation "io.netty:netty-all"
+
+ testImplementation "org.assertj:assertj-core"
+
+ testImplementation "org.mockito:mockito-core"
+ testImplementation "org.mockito:mockito-junit-jupiter"
+}
diff --git a/eventmesh-common/gradle.properties b/eventmesh-common/gradle.properties
new file mode 100644
index 0000000000..b1312a0905
--- /dev/null
+++ b/eventmesh-common/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.
+#
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
new file mode 100644
index 0000000000..867d50b43b
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/Constants.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+public class Constants {
+
+ public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
+
+ public static final String DATE_FORMAT_INCLUDE_MILLISECONDS = "yyyy-MM-dd HH:mm:ss.SSS";
+
+ public static final String DATE_FORMAT_DEFAULT = "yyyy-MM-dd HH:mm:ss";
+
+ public static final String DATA_CONTENT_TYPE = "datacontenttype";
+
+ public static final String LANGUAGE_JAVA = "JAVA";
+
+ public static final String CONNECT_SERVER_CONFIG_FILE_NAME = "server-config.yml";
+
+ public static final String HTTP_PROTOCOL_PREFIX = "http://";
+
+ public static final String HTTPS_PROTOCOL_PREFIX = "https://";
+
+ public static final String PROTOCOL_TYPE = "protocoltype";
+
+ public static final String PROTOCOL_VERSION = "protocolversion";
+
+ public static final String PROTOCOL_DESC = "protocoldesc";
+
+ public static final int DEFAULT_HTTP_TIME_OUT = 15000;
+
+ public static final String EVENTMESH_MESSAGE_CONST_TTL = "ttl";
+
+ public static final String DEFAULT_EVENTMESH_MESSAGE_TTL = "4000";
+
+ public static final Integer DEFAULT_CLIENT_UNACK = 12;
+
+ public static final String CONSTANTS_SERVICE_DESC_ENV = "env";
+
+ public static final String CONSTANTS_SERVICE_DESC_VERSION = "version";
+
+ public static final String CONSTANTS_INSTANCE_DESC_ENV = "env";
+
+ public static final String CONSTANTS_INSTANCE_DESC_IDC = "idc";
+
+ public static final String CONSTANTS_INSTANCE_DESC_SYSID = "sysId";
+
+ public static final String CONSTANTS_INSTANCE_DESC_IP = "ip";
+
+ public static final String CONSTANTS_INSTANCE_DESC_PORT = "port";
+
+ public static final String KEY_CONSTANTS_INSTANCE_DESC_PID = "pid";
+
+ public static final String RMB_UNIQ_ID = "rmbuniqid";
+
+ public static final String IDC_SEPERATER = "-";
+
+ public static final String PROPERTY_MESSAGE_TIMEOUT = "timeout";
+
+ public static final String PROPERTY_MESSAGE_SEARCH_KEYS = "searchkeys";
+
+ public static final String PROPERTY_MESSAGE_QUEUE_ID = "queueid";
+
+ public static final String PROPERTY_MESSAGE_QUEUE_OFFSET = "queueoffset";
+
+ public static final String PROPERTY_MESSAGE_DESTINATION = "destination";
+
+ public static final String PROPERTY_MESSAGE_MESSAGE_ID = "messageid";
+
+ public static final String PROPERTY_MESSAGE_BORN_HOST = "bornhost";
+
+ public static final String PROPERTY_MESSAGE_BORN_TIMESTAMP = "borntimestamp";
+
+ public static final String PROPERTY_MESSAGE_STORE_HOST = "storehost";
+
+ public static final String PROPERTY_MESSAGE_STORE_TIMESTAMP = "storetimestamp";
+
+ public static final String MESSAGE_PROP_SEPARATOR = "99";
+
+ public static final String EVENTMESH_CONF_HOME = System.getProperty("confPath", System.getenv("confPath"));
+
+ public static final String PRODUCER_ID = "PRODUCER_ID";
+
+ public static final String CONSUMER_ID = "CONSUMER_ID";
+
+ public static final String BROADCAST_PREFIX = "broadcast-";
+
+ public static final String IS_BROADCAST = "isBroadcast";
+
+ public static final String CONSUMER_GROUP = "consumerGroup";
+
+ public static final String PRODUCER_GROUP = "producerGroup";
+
+ public static final String PRODUCER_TOKEN = "producerToken";
+
+ public static final String CONSUMER_TOKEN = "consumerToken";
+
+ public static final String INSTANCE_NAME = "instanceName";
+
+ public static final String ACCESS_POINTS = "ACCESS_POINTS";
+
+ public static final String CLIENT_ADDRESS = "clientAddress";
+
+ public static final String REGION = "REGION";
+
+ public static final String MESSAGE_MODEL = "MESSAGE_MODEL";
+
+ public static final String NAMESPACE = "namespace";
+
+ public static final String RMQ_PRODUCER_GROUP = "RMQ_PRODUCER_GROUP";
+
+ public static final String OPERATION_TIMEOUT = "OPERATION_TIMEOUT";
+
+ public static final String CLOUD_EVENTS_PROTOCOL_NAME = "cloudevents";
+
+ public static final String EM_MESSAGE_PROTOCOL_NAME = "eventmeshmessage";
+
+ public static final String OPEN_MESSAGE_PROTOCOL_NAME = "openmessage";
+
+ // delimiter define
+ public static final String COMMA = ",";
+
+ public static final String VERTICAL_LINE = "|";
+
+ public static final String COLON = ":";
+
+ public static final String HYPHEN = "-";
+
+ public static final String DOT = ".";
+
+ public static final String POUND = "#";
+
+ public static final String ASTERISK = "*";
+
+ public static final String UNDER_LINE = "_";
+
+ public static final String UNKNOWN = "unknown";
+
+ public static final String LEFT_PARENTHESIS = "(";
+
+ public static final String RIGHT_PARENTHESIS = ")";
+
+ public static final String LINE_BREAK = "\n";
+
+ public static final String TAB = "\t";
+
+ public static final String AT = "@";
+
+ public static final String QUESTION_MARK = "?";
+
+ public static final String AND = "&";
+
+ public static final String EQ = "=";
+
+ public static final String EMPTY = "";
+
+ public static final int SUCCESS_CODE = 200;
+
+ public static final String SINK = "Sink";
+
+ public static final String SOURCE = "Source";
+
+ // protocol desc
+ public static final String PROTOCOL_DESC_GRPC_CLOUD_EVENT = "grpc-cloud-event";
+
+ public static final String PROTOCOL_DESC_HTTP = "http";
+
+ public static final String PROTOCOL_DESC_TCP = "tcp";
+
+ /**
+ * GRPC PROTOCOL
+ */
+ public static final String PROTOCOL_GRPC = "grpc";
+
+ /**
+ * application/cloudevents+json Content-type
+ */
+ public static final String CONTENT_TYPE_CLOUDEVENTS_JSON = "application/cloudevents+json";
+
+ public static final String HTTP = "HTTP";
+
+ public static final String TCP = "TCP";
+
+ public static final String GRPC = "GRPC";
+
+ public static final String OS_NAME_KEY = "os.name";
+
+ public static final String OS_WIN_PREFIX = "win";
+
+ public static final String DEFAULT = "default";
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshDateFormat.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshDateFormat.java
new file mode 100644
index 0000000000..c25862ec96
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshDateFormat.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;
+
+import java.text.SimpleDateFormat;
+
+public class EventMeshDateFormat extends SimpleDateFormat {
+
+ public EventMeshDateFormat(final String pattern) {
+ super(pattern);
+ }
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshMessage.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshMessage.java
new file mode 100644
index 0000000000..9175ca45d2
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshMessage.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.HashMap;
+import java.util.Map;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * EventMesh message.
+ */
+@Builder
+@Data
+public class EventMeshMessage {
+
+ private String bizSeqNo;
+
+ private String uniqueId;
+
+ private String topic;
+
+ private String content;
+
+ @Builder.Default
+ private Map prop = new HashMap<>();
+
+ @Builder.Default
+ private final long createTime = System.currentTimeMillis();
+
+ public EventMeshMessage addProp(String key, String val) {
+ prop.put(key, val);
+ return this;
+ }
+
+ public String getProp(String key) {
+ if (prop == null) {
+ return null;
+ }
+ return prop.get(key);
+ }
+
+ public EventMeshMessage removePropIfPresent(String key) {
+ if (prop == null) {
+
+ return this;
+ }
+ prop.remove(key);
+ return this;
+ }
+
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshThreadFactory.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshThreadFactory.java
new file mode 100644
index 0000000000..0442ef1286
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshThreadFactory.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.common;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.Nonnull;
+
+import lombok.Getter;
+
+public class EventMeshThreadFactory implements ThreadFactory {
+
+ @Getter
+ private final String threadNamePrefix;
+ private final AtomicInteger threadIndex;
+ private final boolean daemon;
+ private final Integer priority;
+
+ public EventMeshThreadFactory(final String threadNamePrefix, final AtomicInteger threadIndex, final boolean daemon,
+ final Integer priority) {
+ this.threadNamePrefix = threadNamePrefix;
+ this.threadIndex = threadIndex;
+ this.daemon = daemon;
+ this.priority = priority;
+ }
+
+ public EventMeshThreadFactory(final String threadNamePrefix, final AtomicInteger threadIndex,
+ final boolean daemon) {
+ this(threadNamePrefix, threadIndex, daemon, null);
+ }
+
+ public EventMeshThreadFactory(final String threadNamePrefix, final boolean daemon, final Integer priority) {
+ this(threadNamePrefix, new AtomicInteger(0), daemon, priority);
+ }
+
+ public EventMeshThreadFactory(final String threadNamePrefix, final boolean daemon) {
+ this(threadNamePrefix, new AtomicInteger(0), daemon);
+ }
+
+ public EventMeshThreadFactory(final String threadNamePrefix) {
+ this(threadNamePrefix, new AtomicInteger(0), false);
+ }
+
+ /**
+ * Constructs a new {@code Thread}. Implementations may also initialize priority, name, daemon status, {@code ThreadGroup}, etc.
+ *
+ * @param runnable a runnable to be executed by new thread instance
+ * @return constructed thread, or {@code null} if the request to create a thread is rejected
+ */
+ @Override
+ public Thread newThread(@Nonnull final Runnable runnable) {
+
+ StringBuilder threadName = new StringBuilder(threadNamePrefix);
+ if (null != threadIndex) {
+ threadName.append("-").append(threadIndex.incrementAndGet());
+ }
+ Thread thread = new Thread(runnable, threadName.toString());
+ thread.setDaemon(daemon);
+ if (null != priority) {
+ thread.setPriority(priority);
+ }
+
+ return thread;
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/ResetCountDownLatch.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ResetCountDownLatch.java
new file mode 100644
index 0000000000..bb6a01f976
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ResetCountDownLatch.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.TimeUnit;
+import java.util.concurrent.locks.AbstractQueuedSynchronizer;
+
+/**
+ * ResetCountDownLatch can reset
+ *
+ * @see java.util.concurrent.CountDownLatch
+ */
+public class ResetCountDownLatch {
+
+ private final RestSync restSync;
+
+ public ResetCountDownLatch(int count) {
+ this.restSync = new RestSync(count);
+ }
+
+ /**
+ * Causes the current thread to wait until the latch has counted down to zero, unless the thread is {@linkplain Thread#interrupt interrupted}.
+ *
+ *
If the current count is zero then this method returns immediately.
+ *
+ *
If the current count is greater than zero then the current
+ * thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happen:
+ *
+ *
The count reaches zero due to invocations of the
+ * {@link #countDown} method; or
+ *
Some other thread {@linkplain Thread#interrupt interrupts}
+ * the current thread.
+ *
+ *
+ *
If the current thread:
+ *
+ *
has its interrupted status set on entry to this method; or
+ *
is {@linkplain Thread#interrupt interrupted} while waiting,
+ *
+ * then {@link InterruptedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ * @throws InterruptedException if the current thread is interrupted while waiting
+ */
+ public void await() throws InterruptedException {
+ restSync.acquireSharedInterruptibly(1);
+ }
+
+ /**
+ * Causes the current thread to wait until the latch has counted down to zero, unless the thread is {@linkplain Thread#interrupt interrupted}, or
+ * the specified waiting time elapses.
+ *
+ *
If the current count is zero then this method returns immediately
+ * with the value {@code true}.
+ *
+ *
If the current count is greater than zero then the current
+ * thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happen:
+ *
+ *
The count reaches zero due to invocations of the
+ * {@link #countDown} method; or
+ *
Some other thread {@linkplain Thread#interrupt interrupts}
+ * the current thread; or
+ *
The specified waiting time elapses.
+ *
+ *
+ *
If the count reaches zero then the method returns with the
+ * value {@code true}.
+ *
+ *
If the current thread:
+ *
+ *
has its interrupted status set on entry to this method; or
+ *
is {@linkplain Thread#interrupt interrupted} while waiting,
+ *
+ * then {@link InterruptedException} is thrown and the current thread's
+ * interrupted status is cleared.
+ *
+ *
If the specified waiting time elapses then the value {@code false}
+ * is returned. If the time is less than or equal to zero, the method
+ * will not wait at all.
+ *
+ * @param timeout the maximum time to wait
+ * @param unit the time unit of the {@code timeout} argument
+ * @return {@code true} if the count reached zero and {@code false} if the waiting time elapsed before the count reached zero
+ * @throws InterruptedException if the current thread is interrupted while waiting
+ */
+ public boolean await(long timeout, TimeUnit unit)
+ throws InterruptedException {
+ return restSync.tryAcquireSharedNanos(1, unit.toNanos(timeout));
+ }
+
+ /**
+ * Decrements the count of the latch, releasing all waiting threads if the count reaches zero.
+ *
+ *
If the current count is greater than zero then it is decremented.
+ * If the new count is zero then all waiting threads are re-enabled for thread scheduling purposes.
+ *
+ *
If the current count equals zero then nothing happens.
+ */
+ public void countDown() {
+ restSync.releaseShared(1);
+ }
+
+ /**
+ * Returns the current count.
+ *
+ *
This method is typically used for debugging and testing purposes.
+ *
+ * @return the current count
+ */
+ public int getCount() {
+ return restSync.getCount();
+ }
+
+ /**
+ * Reset the CountDownLatch
+ */
+ public void reset() {
+ restSync.reset();
+ }
+
+ /**
+ * Synchronization control For ResetCountDownLatch. Uses AQS state to represent count.
+ */
+ private static final class RestSync extends AbstractQueuedSynchronizer {
+
+ private final int initCount;
+
+ RestSync(int count) {
+ if (count < 0) {
+ throw new IllegalArgumentException("count must be greater than or equal to 0");
+ }
+ this.initCount = count;
+ setState(count);
+ }
+
+ protected void reset() {
+ setState(initCount);
+ }
+
+ int getCount() {
+ return getState();
+ }
+
+ @Override
+ protected int tryAcquireShared(int acquires) {
+ return (getState() == 0) ? 1 : -1;
+ }
+
+ @Override
+ protected boolean tryReleaseShared(int releases) {
+ for (;;) {
+ int count = getState();
+ if (count == 0) {
+ return false;
+ }
+ int nextCount = count - 1;
+ if (compareAndSetState(count, nextCount)) {
+ return nextCount == 0;
+ }
+ }
+ }
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadPoolFactory.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadPoolFactory.java
new file mode 100644
index 0000000000..7b1cc6d948
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadPoolFactory.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.BlockingQueue;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public abstract class ThreadPoolFactory {
+
+ private ThreadPoolFactory() {
+ }
+
+ public static ThreadPoolExecutor createThreadPoolExecutor(int core, int max, final String threadName) {
+ return createThreadPoolExecutor(core, max, threadName, true);
+ }
+
+ public static ThreadPoolExecutor createThreadPoolExecutor(int core, int max, final String threadName,
+ final boolean isDaemon) {
+ return createThreadPoolExecutor(core, max, new LinkedBlockingQueue<>(1000), threadName, isDaemon);
+ }
+
+ public static ThreadPoolExecutor createThreadPoolExecutor(int core, int max, BlockingQueue blockingQueue,
+ final String threadName, final boolean isDaemon) {
+ return new ThreadPoolExecutor(core, max, 10 * 1000, TimeUnit.MILLISECONDS, blockingQueue,
+ new EventMeshThreadFactory(threadName, isDaemon));
+ }
+
+ public static ThreadPoolExecutor createThreadPoolExecutor(int core, int max, BlockingQueue blockingQueue,
+ ThreadFactory threadFactory) {
+ return new ThreadPoolExecutor(core, max, 10 * 1000, TimeUnit.MILLISECONDS, blockingQueue, threadFactory);
+ }
+
+ public static ScheduledExecutorService createSingleScheduledExecutor(final String threadName) {
+ return Executors.newSingleThreadScheduledExecutor(new EventMeshThreadFactory(threadName, true));
+ }
+
+ public static ScheduledExecutorService createScheduledExecutor(int core, ThreadFactory threadFactory) {
+ return Executors.newScheduledThreadPool(core, threadFactory);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadWrapper.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadWrapper.java
new file mode 100644
index 0000000000..b24402c5fe
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/ThreadWrapper.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public abstract class ThreadWrapper implements Runnable {
+
+ private final AtomicBoolean started = new AtomicBoolean(false);
+ protected Thread thread;
+ protected final ResetCountDownLatch waiter = new ResetCountDownLatch(1);
+ protected volatile AtomicBoolean hasWakeup = new AtomicBoolean(false);
+ protected boolean isDaemon = false;
+ protected volatile boolean isRunning = false;
+
+ public ThreadWrapper() {
+
+ }
+
+ public abstract String getThreadName();
+
+ public void start() {
+
+ if (!started.compareAndSet(false, true)) {
+ log.warn("Start thread:{} fail", getThreadName());
+ return;
+ }
+ this.thread = new Thread(this, getThreadName());
+ this.thread.setDaemon(isDaemon);
+ this.thread.start();
+ this.isRunning = true;
+ log.info("Start thread:{} success", getThreadName());
+ }
+
+ public void await() {
+ if (hasWakeup.compareAndSet(true, false)) {
+ return;
+ }
+ // reset count
+ waiter.reset();
+ try {
+ waiter.await();
+ } catch (InterruptedException e) {
+ log.error("Thread[{}] Interrupted", getThreadName(), e);
+ } finally {
+ hasWakeup.set(false);
+ }
+ }
+
+ public void await(long timeout) {
+ await(timeout, TimeUnit.MILLISECONDS);
+ }
+
+ public void await(long timeout, TimeUnit timeUnit) {
+ if (hasWakeup.compareAndSet(true, false)) {
+ return;
+ }
+ // reset count
+ waiter.reset();
+ try {
+ waiter.await(timeout, timeUnit == null ? TimeUnit.MILLISECONDS : timeUnit);
+ } catch (InterruptedException e) {
+ log.error("Thread[{}] Interrupted", getThreadName(), e);
+ } finally {
+ hasWakeup.set(false);
+ }
+ }
+
+ public void wakeup() {
+ if (hasWakeup.compareAndSet(false, true)) {
+ waiter.countDown();
+ }
+ }
+
+ public void shutdownImmediately() {
+ shutdown(true);
+ }
+
+ public void shutdown() {
+ shutdown(false);
+ }
+
+ private void shutdown(final boolean interruptThread) {
+ if (!started.compareAndSet(true, false)) {
+ return;
+ }
+ this.isRunning = false;
+ // wakeup the thread to run
+ wakeup();
+
+ try {
+ if (interruptThread) {
+ this.thread.interrupt();
+ }
+ if (!this.isDaemon) {
+ // wait main thread to wait this thread finish
+ this.thread.join(TimeUnit.SECONDS.toMillis(60));
+ }
+ } catch (InterruptedException e) {
+ log.error("Thread[{}] Interrupted", getThreadName(), e);
+ }
+ }
+
+ public void setDaemon(boolean daemon) {
+ isDaemon = daemon;
+ }
+
+ public boolean isStated() {
+ return this.started.get();
+ }
+}
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
new file mode 100644
index 0000000000..338edf3536
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import static org.apache.eventmesh.common.Constants.HTTP;
+
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.utils.IPUtils;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.assertj.core.util.Strings;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@Config(prefix = "eventMesh")
+public class CommonConfiguration {
+
+ @ConfigFiled(field = "sysid", beNumber = true, notEmpty = true)
+ private String sysID = "5477";
+
+ @ConfigFiled(field = "server.env", notEmpty = true)
+ private String eventMeshEnv = "P";
+
+ @ConfigFiled(field = "server.idc", notEmpty = true)
+ private String eventMeshIDC = "FT";
+
+ @ConfigFiled(field = "server.name", notEmpty = true)
+ private String eventMeshName = "";
+
+ @ConfigFiled(field = "server.cluster", notEmpty = true)
+ private String eventMeshCluster = "LS";
+
+ @ConfigFiled(field = "server.hostIp", reload = true)
+ private String eventMeshServerIp = null;
+
+ @ConfigFiled(field = "metaStorage.plugin.server-addr", notEmpty = true)
+ private String metaStorageAddr = "";
+
+ @ConfigFiled(field = "metaStorage.plugin.type", notEmpty = true)
+ private String eventMeshMetaStoragePluginType = "nacos";
+
+ @ConfigFiled(field = "metaStorage.plugin.username")
+ private String eventMeshMetaStoragePluginUsername = "";
+
+ @ConfigFiled(field = "metaStorage.plugin.password")
+ private String eventMeshMetaStoragePluginPassword = "";
+
+ @ConfigFiled(field = "metaStorage.plugin.metaStorageIntervalInMills")
+ private Integer eventMeshMetaStorageIntervalInMills = 10 * 1000;
+
+ @ConfigFiled(field = "metaStorage.plugin.fetchMetaStorageAddrIntervalInMills")
+ private Integer eventMeshFetchMetaStorageAddrInterval = 10 * 1000;
+
+ @ConfigFiled(field = "metaStorage.plugin.enabled")
+ private boolean eventMeshServerMetaStorageEnable = false;
+
+ @ConfigFiled(field = "trace.plugin", notEmpty = true)
+ private String eventMeshTracePluginType;
+
+ @ConfigFiled(field = "metrics.plugin", notEmpty = true)
+ private List eventMeshMetricsPluginType;
+
+ @ConfigFiled(field = "security.plugin.type", notEmpty = true)
+ private String eventMeshSecurityPluginType = "security";
+
+ @ConfigFiled(field = "connector.plugin.type", notEmpty = true)
+ private String eventMeshConnectorPluginType = "rocketmq";
+
+ @ConfigFiled(field = "storage.plugin.type", notEmpty = true)
+ private String eventMeshStoragePluginType = "rocketmq";
+
+ @ConfigFiled(field = "security.validation.type.token", notEmpty = true)
+ private boolean eventMeshSecurityValidateTypeToken = false;
+
+ @ConfigFiled(field = "server.trace.enabled")
+ private boolean eventMeshServerTraceEnable = false;
+
+ @ConfigFiled(field = "server.security.enabled")
+ private boolean eventMeshServerSecurityEnable = false;
+
+ @ConfigFiled(field = "security.publickey")
+ private String eventMeshSecurityPublickey = "";
+
+ @ConfigFiled(field = "server.provide.protocols", reload = true)
+ private List eventMeshProvideServerProtocols;
+
+ @ConfigFiled(reload = true)
+ private String eventMeshWebhookOrigin;
+
+ @ConfigFiled(reload = true)
+ private String meshGroup;
+
+ @ConfigFiled(field = "server.retry.plugin.type")
+ private String eventMeshRetryPluginType = Constants.DEFAULT;
+
+ public void reload() {
+ this.eventMeshWebhookOrigin = "eventmesh." + eventMeshIDC;
+
+ if (Strings.isNullOrEmpty(this.eventMeshServerIp)) {
+ this.eventMeshServerIp = IPUtils.getLocalAddress();
+ }
+
+ if (CollectionUtils.isEmpty(eventMeshProvideServerProtocols)) {
+ this.eventMeshProvideServerProtocols = Collections.singletonList(HTTP);
+ }
+
+ meshGroup = String.join("-", this.eventMeshEnv, this.eventMeshIDC, this.eventMeshCluster, this.sysID);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/Config.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/Config.java
new file mode 100644
index 0000000000..6c6d726525
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/Config.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.config;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Record information about the configuration class to be converted
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Repeatable(Config.Configs.class)
+public @interface Config {
+
+ String field() default "";
+
+ String path() default "";
+
+ String prefix() default "";
+
+ String hump() default ".";
+
+ boolean removePrefix() default true;
+
+ boolean monitor() default false;
+
+ String reloadMethodName() default "reload";
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE)
+ @interface Configs {
+
+ Config[] value();
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigFiled.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigFiled.java
new file mode 100644
index 0000000000..d7c398e2db
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigFiled.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import org.apache.eventmesh.common.config.convert.ConvertValue.DefaultConverter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Record information about the field in the configuration class to be converted
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.FIELD})
+public @interface ConfigFiled {
+
+ /**
+ * @return The key name of the configuration file
+ */
+ String field() default "";
+
+ /**
+ * Note : When reload is true, the class must have a reload method
+ *
+ * @return Whether to reload. This parameter is used when other fields are associated
+ */
+ boolean reload() default false;
+
+ /**
+ * In some special cases, used to specify the converter class of the field
+ *
+ * @return field converter
+ */
+ Class> converter() default DefaultConverter.class;
+
+ /**
+ * if the configuration filed is empty, try to read from env, by field
+ *
+ * @return Whether to try to read from env if the configuration filed is empty
+ */
+ boolean findEnv() default false;
+
+ /**
+ * If it cannot be null but is null, an exception is thrown
+ *
+ * @return Whether the field can be null
+ */
+ boolean notNull() default false;
+
+ /**
+ * If it cannot be empty but is empty, an exception is thrown
+ *
+ * @return Whether the field can be empty
+ */
+ boolean notEmpty() default false;
+
+ /**
+ * If it's not a number, an exception is thrown
+ *
+ * @return Whether the field must be number
+ */
+ boolean beNumber() default false;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java
new file mode 100644
index 0000000000..e87b119788
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.common.config;
+
+import java.lang.reflect.Field;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class ConfigInfo {
+
+ public static final String HUMP_SPOT = "spot";
+ public static final String HUMP_ROD = "rod";
+
+ private String path;
+ private String field;
+ private String prefix;
+ private String hump;
+ private boolean monitor;
+ private boolean removePrefix;
+
+ private Class> clazz;
+ private Object object;
+ private String filePath;
+
+ private String reloadMethodName;
+
+ Field objectField;
+ Object instance;
+
+ private String resourceUrl;
+}
\ No newline at end of file
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigMonitorService.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigMonitorService.java
new file mode 100644
index 0000000000..5c4000b60c
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigMonitorService.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import org.apache.eventmesh.common.ThreadPoolFactory;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class ConfigMonitorService {
+
+ private static final long TIME_INTERVAL = 30 * 1000L;
+
+ private final List configInfoList = new ArrayList<>();
+
+ private final ScheduledExecutorService configLoader = ThreadPoolFactory.createSingleScheduledExecutor("eventMesh-configLoader");
+
+ {
+ configLoader.scheduleAtFixedRate(this::load, TIME_INTERVAL, TIME_INTERVAL, TimeUnit.MILLISECONDS);
+ }
+
+ public void monitor(ConfigInfo configInfo) {
+ configInfoList.add(configInfo);
+ }
+
+ public void load() {
+ for (ConfigInfo configInfo : configInfoList) {
+ try {
+ Object object = ConfigService.getInstance().getConfig(configInfo);
+ if (configInfo.getObject().equals(object)) {
+ continue;
+ }
+
+ Field field = configInfo.getObjectField();
+ boolean isAccessible = field.isAccessible();
+ try {
+ field.setAccessible(true);
+ field.set(configInfo.getInstance(), object);
+ } finally {
+ field.setAccessible(isAccessible);
+ }
+
+ configInfo.setObject(object);
+ log.info("config reload success: {}", object);
+ } catch (Exception e) {
+ log.error("config reload failed", e);
+ }
+ }
+ }
+
+}
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
new file mode 100644
index 0000000000..7c5b17d7e6
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import static org.apache.eventmesh.common.utils.ReflectUtils.lookUpFieldByParentClass;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.util.Objects;
+import java.util.Properties;
+
+import org.assertj.core.util.Strings;
+
+import lombok.Getter;
+
+public class ConfigService {
+
+ private static final ConfigService INSTANCE = new ConfigService();
+
+ public static final String CLASS_PATH_PREFIX = "classPath://";
+ public static final String FILE_PATH_PREFIX = "file://";
+
+ /**
+ * Unified configuration Properties corresponding to eventmesh.properties
+ */
+ private Properties properties = new Properties();
+
+ @Getter
+ private String rootPath;
+
+ private static final ConfigMonitorService configMonitorService = new ConfigMonitorService();
+
+ private String configPath;
+
+ public static ConfigService getInstance() {
+ return INSTANCE;
+ }
+
+ private ConfigService() {
+ }
+
+ public ConfigService setConfigPath(String configPath) {
+ this.configPath = configPath;
+ return this;
+ }
+
+ public void setRootConfig(String path) throws Exception {
+ ConfigInfo configInfo = new ConfigInfo();
+ rootPath = path;
+ configInfo.setPath(rootPath);
+ properties = this.getConfig(configInfo);
+ }
+
+ public Properties getRootConfig() {
+ return this.properties;
+ }
+
+ public T buildConfigInstance(Class> clazz) {
+
+ Config[] configArray = clazz.getAnnotationsByType(Config.class);
+ Config config = configArray.length == 0 ? null : configArray[0];
+ ConfigInfo configInfo = new ConfigInfo();
+ configInfo.setClazz(clazz);
+ configInfo.setPath(config == null ? null : config.path());
+ configInfo.setHump(config == null ? ConfigInfo.HUMP_SPOT : config.hump());
+ configInfo.setPrefix(config == null ? null : config.prefix());
+ configInfo.setMonitor(config != null && config.monitor());
+ configInfo.setReloadMethodName(config == null ? null : config.reloadMethodName());
+
+ try {
+ return this.getConfig(configInfo);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void populateConfigForObject(Object object) throws IllegalAccessException, NoSuchFieldException, IOException {
+ Class> clazz = object.getClass();
+ Config[] configArray = clazz.getAnnotationsByType(Config.class);
+ if (configArray.length == 0) {
+ return;
+ }
+
+ for (Config config : configArray) {
+ populateConfig(object, clazz, config);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getConfig(ConfigInfo configInfo) throws IOException {
+ Object object;
+
+ String path = configInfo.getPath();
+ if (StringUtils.isBlank(path)) {
+ object = FileLoad.getPropertiesFileLoad().getConfig(properties, configInfo);
+ return (T) object;
+ }
+
+ String filePath;
+ String resourceUrl = null;
+ if (path.startsWith(CLASS_PATH_PREFIX)) {
+ resourceUrl = "/" + path.substring(CLASS_PATH_PREFIX.length());
+ URL fileURL = getClass().getResource(resourceUrl);
+ if (fileURL == null) {
+ throw new RuntimeException("file is not exists");
+ }
+ filePath = fileURL.getPath();
+ } else {
+ filePath = path.startsWith(FILE_PATH_PREFIX) ? path.substring(FILE_PATH_PREFIX.length()) : this.configPath + path;
+ }
+
+ if (filePath.contains(".jar")) {
+ try (final InputStream inputStream = getClass().getResourceAsStream(Objects.requireNonNull(resourceUrl))) {
+ if (inputStream == null) {
+ throw new RuntimeException("file is not exists");
+ }
+ }
+ } else {
+ File file = new File(filePath);
+ if (!file.exists()) {
+ throw new RuntimeException("file is not exists");
+ }
+ }
+
+ String suffix = path.substring(path.lastIndexOf('.') + 1);
+ configInfo.setFilePath(filePath);
+ configInfo.setResourceUrl(resourceUrl);
+ object = FileLoad.getFileLoad(suffix).getConfig(configInfo);
+ return (T) object;
+ }
+
+ private void populateConfig(Object object, Class> clazz, Config config)
+ throws NoSuchFieldException, IOException, IllegalAccessException {
+ ConfigInfo configInfo = new ConfigInfo();
+ configInfo.setField(config.field());
+ configInfo.setMonitor(config.monitor());
+ configInfo.setReloadMethodName(config.reloadMethodName());
+
+ Field field = null;
+ try {
+ field = clazz.getDeclaredField(configInfo.getField());
+ } catch (NoSuchFieldException e) {
+ field = lookUpFieldByParentClass(clazz, configInfo.getField());
+ if (field == null) {
+ throw e;
+ }
+ }
+ configInfo.setClazz(field.getType());
+
+ Config configType = field.getType().getAnnotation(Config.class);
+ if (configType != null && !Strings.isNullOrEmpty(configType.prefix())) {
+ configInfo.setPrefix(configType.prefix());
+ configInfo.setPath(configType.path());
+ configInfo.setHump(configType.hump());
+ }
+
+ Object configObject = this.getConfig(configInfo);
+
+ try {
+ field.setAccessible(true);
+ field.set(object, configObject);
+ } finally {
+ field.setAccessible(false);
+ }
+ if (configInfo.isMonitor()) {
+ configInfo.setObjectField(field);
+ configInfo.setInstance(object);
+ configInfo.setObject(configObject);
+ configMonitorService.monitor(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
new file mode 100644
index 0000000000..adfdc9f581
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import org.apache.eventmesh.common.Constants;
+import org.apache.eventmesh.common.config.convert.Convert;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Objects;
+import java.util.Properties;
+
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ * load config from file
+ */
+public interface FileLoad {
+
+ PropertiesFileLoad PROPERTIES_FILE_LOAD = new PropertiesFileLoad();
+
+ YamlFileLoad YAML_FILE_LOAD = new YamlFileLoad();
+
+ static FileLoad getFileLoad(String fileType) {
+ if (StringUtils.equals("properties", fileType)) {
+ return PROPERTIES_FILE_LOAD;
+ } else if (StringUtils.equals("yaml", fileType)) {
+ return YAML_FILE_LOAD;
+ }
+ return PROPERTIES_FILE_LOAD;
+ }
+
+ static PropertiesFileLoad getPropertiesFileLoad() {
+ return PROPERTIES_FILE_LOAD;
+ }
+
+ static YamlFileLoad getYamlFileLoad() {
+ return YAML_FILE_LOAD;
+ }
+
+ T getConfig(ConfigInfo configInfo) throws IOException;
+
+ class PropertiesFileLoad implements FileLoad {
+
+ private final Convert convert = new Convert();
+
+ @SuppressWarnings("unchecked")
+ public T getConfig(ConfigInfo configInfo) throws IOException {
+ final Properties properties = new Properties();
+ if (StringUtils.isNotBlank(configInfo.getResourceUrl())) {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(
+ Objects.requireNonNull(getClass().getResourceAsStream(configInfo.getResourceUrl())), Constants.DEFAULT_CHARSET))) {
+ properties.load(reader);
+ }
+ } else {
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(Files.newInputStream(Paths.get(configInfo.getFilePath())), Constants.DEFAULT_CHARSET))) {
+ properties.load(reader);
+ }
+ }
+
+ if (Objects.isNull(configInfo.getClazz())) {
+ return (T) properties;
+ }
+
+ return (T) convert.doConvert(configInfo, properties);
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getConfig(Properties properties, ConfigInfo configInfo) {
+ return (T) convert.doConvert(configInfo, properties);
+ }
+ }
+
+ class YamlFileLoad implements FileLoad {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T getConfig(ConfigInfo configInfo) throws IOException {
+ Yaml yaml = new Yaml();
+ return (T) yaml.loadAs(new BufferedInputStream(new FileInputStream(configInfo.getFilePath())), configInfo.getClazz());
+ }
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/Convert.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/Convert.java
new file mode 100644
index 0000000000..84fbdc380e
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/Convert.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.convert;
+
+import org.apache.eventmesh.common.config.ConfigInfo;
+
+import java.util.Properties;
+
+/**
+ * Used to convert Config properties
+ */
+public class Convert {
+
+ public Object doConvert(ConfigInfo configInfo, Properties properties) {
+ Class> clazz = configInfo.getClazz();
+ ConvertInfo convertInfo = new ConvertInfo();
+ convertInfo.setConfigInfo(configInfo);
+ convertInfo.setProperties(properties);
+ convertInfo.setClazz(clazz);
+
+ ConvertValue> clazzConverter = ConverterMap.getClazzConverter(clazz);
+ return clazzConverter.convert(convertInfo);
+ }
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertInfo.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertInfo.java
new file mode 100644
index 0000000000..4f9c3c7b7e
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertInfo.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.config.convert;
+
+import org.apache.eventmesh.common.config.ConfigInfo;
+
+import java.lang.reflect.Field;
+import java.util.Properties;
+
+import lombok.Data;
+
+/**
+ * Records the information about the field to be converted
+ */
+@Data
+public class ConvertInfo {
+
+ char hump;
+ String key;
+ Field field;
+ Object value;
+ Class> clazz;
+ Properties properties;
+ ConfigInfo configInfo;
+}
diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertValue.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertValue.java
new file mode 100644
index 0000000000..e3870759d0
--- /dev/null
+++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/convert/ConvertValue.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.config.convert;
+
+import org.apache.eventmesh.common.config.ConfigFiled;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Properties;
+
+/**
+ * convert convertInfo to obj
+ *
+ * @param obj type
+ */
+public interface ConvertValue {
+
+ T convert(ConvertInfo convertInfo);
+
+ /**
+ * @return Whether can to process null values
+ */
+ default boolean canHandleNullValue() {
+ return false;
+ }
+
+ /**
+ * @return The value converter needs
+ */
+ default Object processFieldValue(ConvertInfo convertInfo, String key, ConfigFiled configFiled) {
+ Properties properties = convertInfo.getProperties();
+ String value = properties.getProperty(key);
+
+ if (Objects.isNull(value)) {
+ return null;
+ }
+
+ value = value.trim();
+
+ boolean findEnv = configFiled.findEnv();
+ String fieldName = configFiled.field();
+
+ if (StringUtils.isBlank(value) && !StringUtils.isBlank(fieldName) && findEnv) {
+ value = Optional.ofNullable(System.getProperty(fieldName)).orElse(System.getenv(fieldName));
+ }
+
+ if (StringUtils.isBlank(value) && configFiled.notEmpty()) {
+ throw new RuntimeException(key + " can't be empty!");
+ }
+
+ return value;
+ }
+
+ class DefaultConverter implements ConvertValue