diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index beff4ec..cc3762f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -45,9 +45,9 @@ jobs:
CORE_API_DIR="${RUNNER_TEMP}/shenyu-core-api"
git init "${CORE_API_DIR}"
git -C "${CORE_API_DIR}" remote add origin https://github.com/apache/shenyu.git
- git -C "${CORE_API_DIR}" fetch --depth 1 origin 91bd8d0c18fae8a1b297a3a752ab3282643bc7f9
+ git -C "${CORE_API_DIR}" fetch --depth 1 origin 971354fef10260e46e09ed951e0bff4d9b5e4040
git -C "${CORE_API_DIR}" checkout --detach FETCH_HEAD
- "${CORE_API_DIR}/mvnw" -B -ntp -f "${CORE_API_DIR}/pom.xml" -pl shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common,shenyu-web,shenyu-admin-listener/shenyu-admin-listener-api,shenyu-registry/shenyu-registry-api,shenyu-plugin/shenyu-plugin-global,shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide,shenyu-plugin/shenyu-plugin-uri,shenyu-plugin/shenyu-plugin-httpclient,shenyu-plugin/shenyu-plugin-response -am install -DskipTests -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipRemoteResources=true
+ "${CORE_API_DIR}/mvnw" -B -ntp -f "${CORE_API_DIR}/pom.xml" -pl shenyu-sync-data-center/shenyu-sync-data-api,shenyu-registry/shenyu-registry-core,shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common,shenyu-web,shenyu-admin-listener/shenyu-admin-listener-api,shenyu-registry/shenyu-registry-api,shenyu-plugin/shenyu-plugin-global,shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide,shenyu-plugin/shenyu-plugin-uri,shenyu-plugin/shenyu-plugin-httpclient,shenyu-plugin/shenyu-plugin-response -am install -DskipTests -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipRemoteResources=true
- name: Prepare original-suite core APIs
run: |
CORE_API_DIR="${RUNNER_TEMP}/shenyu-core-api"
@@ -62,6 +62,10 @@ jobs:
bash script/plugin-store/prepare-core-artifacts.sh "${CORE_API_DIR}"
- name: Build, test, check style, and verify licenses
run: mvn -B -ntp clean verify -Dapi.version=1.44
+ - name: Verify the complete external Apollo stack
+ run: |
+ mvn -B -ntp -pl shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-sync-data-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-registry-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-spring-boot-starter-sync-data-apollo -am clean verify -Dapi.version=1.44
+ python3 script/plugin-store/check-apollo-packaging.py
- name: Compile preserved original test and example assets
run: mvn -B -ntp -Pintegration-tests,e2e,examples test-compile -DskipTests -Dapi.version=1.44
- name: Verify store-owned SQL installation
diff --git a/README.md b/README.md
index 996610d..1c2e466 100644
--- a/README.md
+++ b/README.md
@@ -266,3 +266,7 @@ starter plus gateway plus backend end-to-end fixture is not included in this cha
In order of registration, More access companies are welcome to register at [https://github.com/apache/shenyu/issues/68](https://github.com/apache/shenyu/issues/68) (For open source users only) .
All Users : [Known Users](https://shenyu.apache.org/community/user-registration)
+
+### Apollo integration
+
+The [Apollo extension](shenyu-extension/shenyu-extension-apollo/README.md) builds its listener, sync adapter, registry and starter together. See [staged migration](docs/plugin-store-apollo.md) for the one-release deprecation and publication contract.
diff --git a/docs/plugin-store-apollo.md b/docs/plugin-store-apollo.md
new file mode 100644
index 0000000..1c6bd65
--- /dev/null
+++ b/docs/plugin-store-apollo.md
@@ -0,0 +1,210 @@
+
+# Apollo plugin-store migration
+
+## Status and deprecation cycle
+
+Apollo is currently an optional, supported in-tree integration. Issue [#7599](https://github.com/apache/shenyu/issues/7599)
+proposes transferring its registry, data-sync, Admin listener and gateway starter to
+[plugin-store](https://github.com/apache/shenyu-plugin-store), extending [#7306](https://github.com/apache/shenyu/issues/7306).
+This guide is the advance deprecation notice: the in-tree modules remain available
+for the release carrying this notice. No removal release has been selected.
+The separate removal PR is a draft and must not be merged in that deprecation release.
+
+| Stage | Required action |
+| --- | --- |
+| Agreement | Obtain and link the dev-list decision approving Apollo externalization. |
+| Deprecation release | Ship this notice and migration guide in a core release while retaining all four in-tree modules. Record that released version publicly. |
+| Receiving parity | Build/test all four modules together in plugin-store, verify external SPI loading and unchanged sync/registry configuration. |
+| Publication | Announce compatible core/store versions, publish external artifacts before cutover, and reserve one publisher per Maven group/artifact/version. |
+| Later core release | After the deprecation release has shipped, merge the separate removal, update the release inventory, and announce the rollback window. |
+
+Do not treat creating PRs, merging documentation, or producing local snapshot JARs
+as completing the dev-list decision, a released deprecation cycle, or artifact publication.
+Keep the issue open until all stages and their release evidence are complete.
+
+## Artifact ownership and installation
+
+The receiving `shenyu-extension-apollo` reactor owns these artifacts together:
+
+- `shenyu-admin-listener-apollo`
+- `shenyu-sync-data-apollo`
+- `shenyu-registry-apollo`
+- `shenyu-spring-boot-starter-sync-data-apollo`
+
+The preparation branch uses store `2.7.1-SNAPSHOT` against core `2.7.2-SNAPSHOT`.
+These are development coordinates, not an announced release compatibility matrix.
+For deployment, select the published store release declared compatible with your core release.
+Use the core version for retained APIs and the store version for **all four** Apollo artifacts.
+Keep exactly one provider version on each runtime classpath; the in-tree and external
+implementations retain identical packages and must not coexist.
+
+Admin needs:
+
+```xml
+
+ org.apache.shenyu
+ shenyu-admin-listener-apollo
+ ${store.version}
+
+```
+
+Gateway data synchronization needs:
+
+```xml
+
+ org.apache.shenyu
+ shenyu-spring-boot-starter-sync-data-apollo
+ ${store.version}
+
+```
+
+Applications using Apollo instance registration or SDK instance discovery additionally need:
+
+```xml
+
+ org.apache.shenyu
+ shenyu-registry-apollo
+ ${store.version}
+
+```
+
+Gateway registration also requires the retained core `shenyu-spring-boot-starter-registry`;
+SDK discovery requires the appropriate SDK starter. Apollo was never included in the
+compatibility registry starter, so it remains an explicit provider dependency.
+For binary distributions, resolve the complete runtime dependency closure into `lib/`,
+replace old Apollo JARs, and retain the extension's licensing information and dependency notices.
+
+Shading continues to package Apollo client dependencies, but excludes retained ShenYu
+API artifacts and sibling extension modules. API classes come from the application's core artifacts, preserving
+class identity for external SPI loading. The published POM retains runtime dependencies.
+
+## Enable Admin and gateway synchronization
+
+Admin keeps its existing property prefix and portal publishing settings:
+
+```yaml
+shenyu:
+ sync:
+ websocket:
+ enabled: false
+ apollo:
+ appId: shenyu
+ meta: http://apollo-config-service:8080
+ portalUrl: http://apollo-portal:8070
+ env: DEV
+ clusterName: default
+ namespace: application
+ token: ${APOLLO_OPENAPI_TOKEN}
+ operatorUser: apollo
+```
+
+Gateway keeps the same reading settings; remove or disable the previous sync channel:
+
+```yaml
+shenyu:
+ namespace: 649330b6-c2d7-4edc-be8e-8a54df9eb385
+ sync:
+ websocket:
+ urls: false
+ apollo:
+ appId: shenyu
+ meta: http://apollo-config-service:8080
+ env: DEV
+ clusterName: default
+ namespace: application
+ accessKey: ${APOLLO_ACCESS_KEY:}
+```
+
+The portal OpenAPI token and config-service access key serve different APIs.
+Ensure the publishing app, environment, cluster and Apollo namespace match the reader.
+The preserved reader calls Apollo `ConfigService.getAppConfig()`, so the example uses
+`application`. This migration does not add arbitrary namespace selection.
+The ShenYu namespace ID is a separate tenant prefix inside Apollo item keys.
+The Apollo client sets JVM-wide app/meta/cluster properties; preserve the existing
+process-level configuration when using sync and registry together.
+
+## Registry and SPI contract
+
+The external JAR continues to publish:
+
+```text
+META-INF/shenyu/org.apache.shenyu.registry.api.ShenyuInstanceRegisterRepository
+apollo=org.apache.shenyu.registry.apollo.ApolloInstanceRegisterRepository
+```
+
+`ShenyuInstanceRegisterRepositoryFactory.loadRepository("apollo")` resolves that
+resource without any factory or core runtime change, and preserves the non-singleton provider.
+Registry configuration remains:
+
+```yaml
+shenyu:
+ register:
+ enabled: true
+ registerType: apollo
+ serverLists: http://apollo-config-service:8080
+ props:
+ appId: shenyu
+ portalUrl: http://apollo-portal:8070
+ token: ${APOLLO_OPENAPI_TOKEN}
+ env: DEV
+ clusterName: default
+ namespace: application
+```
+
+SDK discovery uses the same `apollo` type and registry settings via its existing SDK
+configuration; it does not replace backend HTTP annotation/API registration.
+Instance registration writes persistent portal items and publishes the namespace.
+Existing shutdown removes listeners; it does not deregister persistent instance items.
+Preserve that behavior during migration and apply your existing instance-removal procedure.
+
+## Stored keys and shared compatibility shim
+
+| Data | Existing Apollo item key |
+| --- | --- |
+| Plugin | `.plugin.` |
+| Selector | `.selector..` |
+| Rule | `.rule...` |
+| Authentication | `.auth.` |
+| Metadata | `.meta.` |
+| Proxy selector | `.proxy.selector..` |
+| Discovery upstream | `.discovery..` |
+| Instance | `/shenyu/register/instance//:` |
+
+The existing `.list` index items under each category/group are retained alongside the data keys.
+JSON DTOs, key prefixes, namespace IDs and the `apollo` type remain unchanged.
+`org.apache.shenyu.common.constant.ApolloPathConstants` stays in core as a small
+constants/path compatibility shim with no Apollo SDK dependency. Do not duplicate that
+class in store JARs or migrate/delete existing keyspaces as part of this transfer.
+
+The client versions remain `apollo-client`, `apollo-openapi` and `apollo-core` `2.1.0`.
+Source and the Apollo clients are Apache-2.0; preserve licenses when assembling custom packages.
+Existing unit tests, real Apollo `DefaultConfig` listener filtering tests and starter
+configuration tests move with their modules. Those tests do not claim a full live Apollo
+portal/config-service deployment; validate your staging deployment before production cutover.
+
+## Upgrade and rollback
+
+1. After publication and release gates pass, back up the Admin database and Apollo
+ application/namespace configuration, recording exact core/store versions and deployed JARs.
+2. Verify the external artifacts in staging using unchanged namespace, endpoints, tokens,
+ keys and registry properties. Check initial sync, create/update/delete and instance updates.
+3. Roll Admin and gateways with complete external dependency closures, then confirm
+ subsequent changes propagate and existing instance discovery still works.
+4. Retain the last in-tree release for the announced rollback window. To roll back,
+ restore its images/JARs and configuration and remove the external Apollo versions.
+ Reuse the same Admin database and Apollo keyspace; do not clear either during rollback.
diff --git a/examples/apollo/admin/application.yml b/examples/apollo/admin/application.yml
new file mode 100644
index 0000000..2ca96c3
--- /dev/null
+++ b/examples/apollo/admin/application.yml
@@ -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.
+
+shenyu:
+ sync:
+ apollo:
+ appId: shenyu
+ meta: http://apollo-config-service:8080
+ env: DEV
+ clusterName: default
+ namespace: application
+ portalUrl: http://apollo-portal:8070
+ token: ${APOLLO_OPENAPI_TOKEN}
+ operatorUser: apollo
+ websocket:
+ enabled: false
diff --git a/examples/apollo/gateway/application.yml b/examples/apollo/gateway/application.yml
new file mode 100644
index 0000000..4da20c8
--- /dev/null
+++ b/examples/apollo/gateway/application.yml
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+shenyu:
+ sync:
+ apollo:
+ appId: shenyu
+ meta: http://apollo-config-service:8080
+ env: DEV
+ clusterName: default
+ namespace: application
+ accessKey: ${APOLLO_ACCESS_KEY:}
+ websocket:
+ urls: false
diff --git a/examples/apollo/legacy/shenyu-admin/src/main/resources/application.yml b/examples/apollo/legacy/shenyu-admin/src/main/resources/application.yml
new file mode 100644
index 0000000..790ce2d
--- /dev/null
+++ b/examples/apollo/legacy/shenyu-admin/src/main/resources/application.yml
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# apollo:
+# meta: http://localhost:8080
+# appId: shenyu
+# portalUrl: http://localhost:8070
+# env: dev
+# clusterName: test
+# namespace: application
+# token: 0fff5645fc74ee5e0d63a6389433c8c8afc0beea31eed0279ecc1c8961d12da9
diff --git a/examples/apollo/legacy/shenyu-bootstrap/src/main/resources/application.yml b/examples/apollo/legacy/shenyu-bootstrap/src/main/resources/application.yml
new file mode 100644
index 0000000..8a3fb0b
--- /dev/null
+++ b/examples/apollo/legacy/shenyu-bootstrap/src/main/resources/application.yml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# apollo:
+# appId: shenyu
+# meta: http://localhost:8080
+# env: dev
+# clusterName: test
+# namespace: application
diff --git a/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml
new file mode 100644
index 0000000..8a3fb0b
--- /dev/null
+++ b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# apollo:
+# appId: shenyu
+# meta: http://localhost:8080
+# env: dev
+# clusterName: test
+# namespace: application
diff --git a/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml
new file mode 100644
index 0000000..8a3fb0b
--- /dev/null
+++ b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# apollo:
+# appId: shenyu
+# meta: http://localhost:8080
+# env: dev
+# clusterName: test
+# namespace: application
diff --git a/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml
new file mode 100644
index 0000000..8a3fb0b
--- /dev/null
+++ b/examples/apollo/legacy/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# apollo:
+# appId: shenyu
+# meta: http://localhost:8080
+# env: dev
+# clusterName: test
+# namespace: application
diff --git a/script/plugin-store/check-apollo-packaging.py b/script/plugin-store/check-apollo-packaging.py
new file mode 100644
index 0000000..c590de8
--- /dev/null
+++ b/script/plugin-store/check-apollo-packaging.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+from pathlib import Path
+import zipfile
+
+
+MODULES = {
+ "shenyu-admin-listener-apollo": ("org/apache/shenyu/admin/config/", "org/apache/shenyu/admin/listener/apollo/"),
+ "shenyu-sync-data-apollo": ("org/apache/shenyu/sync/data/apollo/",),
+ "shenyu-registry-apollo": ("org/apache/shenyu/registry/apollo/",),
+ "shenyu-spring-boot-starter-sync-data-apollo": ("org/apache/shenyu/springboot/sync/data/apollo/",),
+}
+
+
+def check(root, version):
+ for module, owned in MODULES.items():
+ artifact = root / "shenyu-extension/shenyu-extension-apollo" / module / "target" / f"{module}-{version}.jar"
+ with zipfile.ZipFile(artifact) as jar:
+ names = jar.namelist()
+ classes = [name for name in names if name.startswith("org/apache/shenyu/") and name.endswith(".class")]
+ if not classes:
+ raise AssertionError(f"{artifact}: missing the extension's implementation classes")
+ unexpected = [name for name in classes if not name.startswith(owned)]
+ if unexpected:
+ raise AssertionError(f"{artifact}: embeds core or sibling classes: {unexpected[:5]}")
+ if module == "shenyu-registry-apollo":
+ registration = jar.read("META-INF/shenyu/org.apache.shenyu.registry.api.ShenyuInstanceRegisterRepository").decode()
+ if "apollo=org.apache.shenyu.registry.apollo.ApolloInstanceRegisterRepository" not in registration:
+ raise AssertionError(f"{artifact}: missing the historical Apollo SPI key")
+ if module in {"shenyu-admin-listener-apollo", "shenyu-spring-boot-starter-sync-data-apollo"}:
+ imports = jar.read("META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports").decode()
+ expected = "org.apache.shenyu.admin.config.ApolloSyncConfiguration" if module == "shenyu-admin-listener-apollo" else "org.apache.shenyu.springboot.sync.data.apollo.ApolloSyncDataConfiguration"
+ if expected not in imports:
+ raise AssertionError(f"{artifact}: missing starter auto-configuration registration")
+ print(f"{module}: implementation, registrations and core API boundary verified")
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description="Check final Apollo extension JAR ownership and runtime registrations.")
+ parser.add_argument("--store-root", type=Path, default=Path(__file__).resolve().parents[2])
+ parser.add_argument("--version", default="2.7.1-SNAPSHOT")
+ args = parser.parse_args()
+ check(args.store_root, args.version)
diff --git a/shenyu-extension/pom.xml b/shenyu-extension/pom.xml
index 97c23fc..cfe4bb9 100644
--- a/shenyu-extension/pom.xml
+++ b/shenyu-extension/pom.xml
@@ -27,5 +27,6 @@
shenyu-extension-consulshenyu-extension-polaris
+ shenyu-extension-apollo
diff --git a/shenyu-extension/shenyu-extension-apollo/LICENSE b/shenyu-extension/shenyu-extension-apollo/LICENSE
new file mode 100644
index 0000000..290d079
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/LICENSE
@@ -0,0 +1,224 @@
+ 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.
+
+=======================================================================
+Apache ShenYu Subcomponents:
+
+The Apache ShenYu project contains subcomponents with separate copyright
+notices and license terms. Your use of the source code for these
+subcomponents is subject to the terms and conditions of the following
+licenses.
+
+========================================================================
+Apache 2.0 licenses
+========================================================================
+
+The following components are provided under the Apache License. See project link for details.
+The text of each license is the standard Apache 2.0 license.
+
+ Maven Wrapper(mvnw, mvnw.cmd files in root path), https://github.com/apache/maven-wrapper Apache 2.0
+
+
+Apollo client dependencies use the Apache License, Version 2.0:
+ apollo-client 2.1.0: https://github.com/apolloconfig/apollo/blob/v2.1.0/LICENSE
+ apollo-openapi 2.1.0: https://github.com/apolloconfig/apollo/blob/v2.1.0/LICENSE
+ apollo-core 2.1.0: https://github.com/apolloconfig/apollo/blob/v2.1.0/LICENSE
diff --git a/shenyu-extension/shenyu-extension-apollo/NOTICE b/shenyu-extension/shenyu-extension-apollo/NOTICE
new file mode 100644
index 0000000..4f0daa2
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/NOTICE
@@ -0,0 +1,5 @@
+Apache ShenYu Apollo Extension
+Copyright 2026 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/shenyu-extension/shenyu-extension-apollo/README.md b/shenyu-extension/shenyu-extension-apollo/README.md
new file mode 100644
index 0000000..cdeb1e3
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/README.md
@@ -0,0 +1,49 @@
+
+# ShenYu Apollo extension
+
+This reactor owns the Admin listener, data-sync adapter, registry provider and sync
+starter together. See [installation, compatibility and staged cutover](../../docs/plugin-store-apollo.md).
+
+Prepare compatible core API artifacts with the core checkout's Maven wrapper:
+
+```bash
+/path/to/shenyu/mvnw -B -ntp -f /path/to/shenyu/pom.xml \
+ -pl shenyu-admin-listener/shenyu-admin-listener-api,shenyu-sync-data-center/shenyu-sync-data-api,shenyu-registry/shenyu-registry-core \
+ -am install -DskipTests -Dmaven.javadoc.skip=true -DskipRemoteResources=true
+```
+
+CI pins core commit `971354fef10260e46e09ed951e0bff4d9b5e4040`. Build/test all four children:
+
+```bash
+mvn -B -ntp -pl shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-sync-data-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-registry-apollo,shenyu-extension/shenyu-extension-apollo/shenyu-spring-boot-starter-sync-data-apollo -am clean verify
+```
+
+After packaging, run `python3 script/plugin-store/check-apollo-packaging.py` to
+verify each final JAR owns its implementation and runtime registration resources
+without embedding core or sibling API classes. CI runs this check.
+
+No live Apollo account or server is needed by the unit/SDK listener-filtering fixtures.
+The real SDK `DefaultConfig` test checks asynchronous interested-key prefix handling;
+Admin OpenAPI boundaries use mocks. Full portal/config-service deployment is a separate
+staging release gate and is not claimed by this test suite.
+
+The shared `ApolloPathConstants` class remains owned by core, preserving downstream
+API compatibility; shaded extension JARs exclude core APIs and sibling providers.
+The initial receiving coordinates use store `2.7.1-SNAPSHOT` against core `2.7.2-SNAPSHOT`.
+Publish only after agreeing on release ownership and compatible versions; main removal
+requires dev-list consensus plus a released deprecation cycle and rollback window.
diff --git a/shenyu-extension/shenyu-extension-apollo/pom.xml b/shenyu-extension/shenyu-extension-apollo/pom.xml
new file mode 100644
index 0000000..b7510a0
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/pom.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ org.apache.shenyu
+ shenyu-extension
+ 2.7.1-SNAPSHOT
+
+ 4.0.0
+ pom
+ shenyu-extension-apollo
+
+
+ 2.1.0
+
+
+
+
+
+ com.ctrip.framework.apollo
+ apollo-client
+ ${apollo.version}
+
+
+ com.ctrip.framework.apollo
+ apollo-openapi
+ ${apollo.version}
+
+
+
+
+
+ shenyu-admin-listener-apollo
+ shenyu-sync-data-apollo
+ shenyu-registry-apollo
+ shenyu-spring-boot-starter-sync-data-apollo
+
+
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/pom.xml b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/pom.xml
new file mode 100644
index 0000000..df818d3
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/pom.xml
@@ -0,0 +1,87 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.shenyu
+ shenyu-extension-apollo
+ 2.7.1-SNAPSHOT
+
+
+ shenyu-admin-listener-apollo
+
+
+
+ com.ctrip.framework.apollo
+ apollo-openapi
+
+
+
+ org.apache.shenyu
+ shenyu-admin-listener-api
+ ${shenyu.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ ${maven-shade-plugin.version}
+
+ false
+
+
+ org.apache.shenyu:shenyu-common
+ org.apache.shenyu:shenyu-spi
+ org.apache.shenyu:shenyu-admin-listener-api
+ org.apache.shenyu:shenyu-sync-data-api
+ org.apache.shenyu:shenyu-registry-api
+ org.apache.shenyu:shenyu-registry-core
+
+
+
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/ApolloSyncConfiguration.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/ApolloSyncConfiguration.java
new file mode 100644
index 0000000..755c794
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/ApolloSyncConfiguration.java
@@ -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.
+ */
+
+package org.apache.shenyu.admin.config;
+
+import org.apache.shenyu.admin.config.properties.ApolloProperties;
+import org.apache.shenyu.admin.listener.DataChangedInit;
+import org.apache.shenyu.admin.listener.DataChangedListener;
+import org.apache.shenyu.admin.listener.apollo.ApolloClient;
+import org.apache.shenyu.admin.listener.apollo.ApolloDataChangedInit;
+import org.apache.shenyu.admin.listener.apollo.ApolloDataChangedListener;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * the type apollo listener.
+ */
+@Configuration
+@ConditionalOnProperty(prefix = "shenyu.sync.apollo", name = "meta")
+@EnableConfigurationProperties(ApolloProperties.class)
+public class ApolloSyncConfiguration {
+
+
+ /**
+ * init Consul client.
+ *
+ * @param apolloProperties the apollo properties
+ * @return apollo client
+ */
+ @Bean
+ public ApolloClient apolloClient(final ApolloProperties apolloProperties) {
+ return new ApolloClient(apolloProperties);
+ }
+
+ /**
+ * Config event listener data changed listener.
+ *
+ * @param apolloClient the apollo client
+ * @return the data changed listener
+ */
+ @Bean
+ @ConditionalOnMissingBean(ApolloDataChangedListener.class)
+ public DataChangedListener apolloDataChangeListener(final ApolloClient apolloClient) {
+ return new ApolloDataChangedListener(apolloClient);
+ }
+
+ /**
+ * apollo data init.
+ *
+ * @param apolloClient the apollo client
+ * @return the apollo data init
+ */
+ @Bean
+ @ConditionalOnMissingBean(ApolloDataChangedInit.class)
+ public DataChangedInit apolloDataChangeInit(final ApolloClient apolloClient) {
+ return new ApolloDataChangedInit(apolloClient);
+ }
+
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/properties/ApolloProperties.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/properties/ApolloProperties.java
new file mode 100644
index 0000000..b1a100f
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/config/properties/ApolloProperties.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.config.properties;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties("shenyu.sync.apollo")
+public class ApolloProperties {
+
+ /**
+ * appId.
+ */
+ private String appId;
+
+ /**
+ * apollo config service url.
+ */
+ private String meta;
+
+ /**
+ * portal url.
+ * e.g. localhost:8080
+ */
+ private String portalUrl;
+
+ /**
+ * env.
+ * e.g. ENV
+ */
+ private String env;
+
+ /**
+ * cluster name.
+ */
+ private String clusterName;
+
+ /**
+ * namespace name.
+ */
+ private String namespace;
+
+ /**
+ * open api use token.
+ */
+ private String token;
+
+ /**
+ * operatorUser.
+ */
+ private String operatorUser;
+
+ /**
+ * get appId.
+ * @return appId
+ */
+ public String getAppId() {
+ return appId;
+ }
+
+ /**
+ * set app id.
+ * @param appId app id
+ */
+ public void setAppId(final String appId) {
+ this.appId = appId;
+ }
+
+ /**
+ * get config service url.
+ * @return config service url
+ */
+ public String getMeta() {
+ return meta;
+ }
+
+ /**
+ * set config service url.
+ * @param meta config service url
+ */
+ public void setMeta(final String meta) {
+ this.meta = meta;
+ }
+
+ /**
+ * get portal url.
+ * @return portal url
+ */
+ public String getPortalUrl() {
+ return portalUrl;
+ }
+
+ /**
+ * set portal url.
+ * @param portalUrl portal url
+ */
+ public void setPortalUrl(final String portalUrl) {
+ this.portalUrl = portalUrl;
+ }
+
+ /**
+ * get env.
+ * @return env
+ */
+ public String getEnv() {
+ return env;
+ }
+
+ /**
+ * set env.
+ * @param env env
+ */
+ public void setEnv(final String env) {
+ this.env = env;
+ }
+
+ /**
+ * get cluster name.
+ * @return cluster name
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * set cluster name.
+ * @param clusterName cluster name
+ */
+ public void setClusterName(final String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * get namespace name.
+ * @return namespace name
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * set namespace name.
+ * @param namespace namespace name
+ */
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ /**
+ * get token.
+ * @return token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * set token.
+ * @param token token
+ */
+ public void setToken(final String token) {
+ this.token = token;
+ }
+
+ /**
+ * operatorUser.
+ *
+ * @return OperatorUser
+ */
+ public String getOperatorUser() {
+ return operatorUser;
+ }
+
+ /**
+ * set operatorUser.
+ *
+ * @param operatorUser operatorUser
+ */
+ public void setOperatorUser(final String operatorUser) {
+ this.operatorUser = operatorUser;
+ }
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java
new file mode 100644
index 0000000..580b942
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloClient.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.listener.apollo;
+
+import com.ctrip.framework.apollo.openapi.client.ApolloOpenApiClient;
+import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO;
+import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
+import org.apache.shenyu.admin.config.properties.ApolloProperties;
+import org.apache.shenyu.common.exception.ShenyuException;
+import org.apache.shenyu.common.utils.GsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * apollo open-api client.
+ */
+public class ApolloClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ApolloClient.class);
+
+ private final String operatorUser;
+
+ private final ApolloProperties apolloConfig;
+
+ private final ApolloOpenApiClient apolloOpenApiClient;
+
+ public ApolloClient(final ApolloProperties apolloConfig) {
+ this.apolloConfig = apolloConfig;
+
+ this.apolloOpenApiClient = ApolloOpenApiClient
+ .newBuilder()
+ .withPortalUrl(apolloConfig.getPortalUrl())
+ .withToken(apolloConfig.getToken())
+ .build();
+ operatorUser = Optional.ofNullable(apolloConfig.getOperatorUser()).orElse("apollo");
+ }
+
+ /**
+ * get item value.
+ * @param key item key
+ * @return item value
+ */
+ public String getItemValue(final String key) {
+ OpenItemDTO openItemDTO = this.apolloOpenApiClient.getItem(
+ apolloConfig.getAppId(),
+ apolloConfig.getEnv(),
+ apolloConfig.getClusterName(),
+ apolloConfig.getNamespace(),
+ key);
+ if (Objects.isNull(openItemDTO)) {
+ return null;
+ }
+ if (openItemDTO.getKey().equals("timeout")) {
+ LOG.error("apollo client getItemValue time out");
+ throw new ShenyuException("apollo client getItemValue time out");
+ }
+ return openItemDTO.getValue();
+ }
+
+
+ /**
+ * removeItemKey.
+ *
+ * @param key key
+ */
+ public void removeItemKey(final String key) {
+ this.apolloOpenApiClient.removeItem(
+ apolloConfig.getAppId(),
+ apolloConfig.getEnv(),
+ apolloConfig.getClusterName(),
+ apolloConfig.getNamespace(),
+ key, operatorUser);
+ }
+
+ /**
+ * create or update item into namespace.
+ * @param key item key
+ * @param value item value
+ * @param comment item comment
+ */
+ public void createOrUpdateItem(final String key, final Object value, final String comment) {
+ this.createOrUpdateItem(key, GsonUtils.getInstance().toJson(value), comment);
+ }
+
+ /**
+ * create or update item into namespace.
+ * @param key item key
+ * @param value item value
+ * @param comment item comment
+ */
+ public void createOrUpdateItem(final String key, final String value, final String comment) {
+ OpenItemDTO openItemDTO = new OpenItemDTO();
+ openItemDTO.setKey(key);
+ openItemDTO.setValue(value);
+ openItemDTO.setComment(comment);
+ openItemDTO.setDataChangeCreatedBy(operatorUser);
+ openItemDTO.setDataChangeLastModifiedBy(operatorUser);
+ Date now = new Date();
+ openItemDTO.setDataChangeCreatedTime(now);
+ openItemDTO.setDataChangeLastModifiedTime(now);
+
+ this.apolloOpenApiClient.createOrUpdateItem(
+ apolloConfig.getAppId(),
+ apolloConfig.getEnv(),
+ apolloConfig.getClusterName(),
+ apolloConfig.getNamespace(),
+ openItemDTO
+ );
+ }
+
+ /**
+ * publish item list in namespace.
+ * @param releaseTitle publish release title
+ * @param releaseComment publish release comment
+ */
+ public void publishNamespace(final String releaseTitle, final String releaseComment) {
+ NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();
+ namespaceReleaseDTO.setReleaseTitle(releaseTitle);
+ namespaceReleaseDTO.setReleaseComment(releaseComment);
+ namespaceReleaseDTO.setReleasedBy(operatorUser);
+
+ this.apolloOpenApiClient.publishNamespace(
+ apolloConfig.getAppId(),
+ apolloConfig.getEnv(),
+ apolloConfig.getClusterName(),
+ apolloConfig.getNamespace(),
+ namespaceReleaseDTO
+ );
+ }
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedInit.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedInit.java
new file mode 100644
index 0000000..ee1090b
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedInit.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.listener.apollo;
+
+import org.apache.shenyu.admin.listener.AbstractDataChangedInit;
+import org.apache.shenyu.admin.listener.utils.NodeDataPathUtils;
+import org.apache.shenyu.common.constant.ApolloPathConstants;
+
+import java.util.Objects;
+import java.util.stream.Stream;
+
+/**
+ * the type apollo data change init.
+ *
+ * @since 2.6.0
+ */
+public class ApolloDataChangedInit extends AbstractDataChangedInit {
+ private final ApolloClient apolloClient;
+
+ /**
+ * Instantiates a new apollo data changed init.
+ *
+ * @param apolloClient the apollo client
+ */
+ public ApolloDataChangedInit(final ApolloClient apolloClient) {
+ this.apolloClient = apolloClient;
+ }
+
+ /**
+ * not exist.
+ *
+ * @return true if not exist
+ */
+ @Override
+ protected boolean notExist() {
+ return Stream.of(ApolloPathConstants.PLUGIN_DATA_ID, ApolloPathConstants.AUTH_DATA_ID, ApolloPathConstants.META_DATA_ID, ApolloPathConstants.PROXY_SELECTOR_DATA_ID)
+ .map(NodeDataPathUtils::appendListStuff)
+ .allMatch(this::dataIdNotExist);
+ }
+
+ /**
+ * Data id not exist boolean.
+ *
+ * @param pluginDataId the plugin data id
+ * @return the boolean
+ */
+ private boolean dataIdNotExist(final String pluginDataId) {
+ return Objects.isNull(apolloClient.getItemValue(pluginDataId));
+ }
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedListener.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedListener.java
new file mode 100644
index 0000000..eab59e1
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/java/org/apache/shenyu/admin/listener/apollo/ApolloDataChangedListener.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.listener.apollo;
+
+import org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener;
+import org.apache.shenyu.common.constant.ApolloPathConstants;
+
+/**
+ * use apollo to push data changes.
+ *
+ * @since 2.6.0
+ */
+public class ApolloDataChangedListener extends AbstractNodeDataChangedListener {
+ private final ApolloClient apolloClient;
+
+ /**
+ * Instantiates a new apollo data changed listener.
+ *
+ * @param apolloClient the apollo client
+ */
+ public ApolloDataChangedListener(final ApolloClient apolloClient) {
+ super(new ChangeData(ApolloPathConstants.PLUGIN_DATA_ID,
+ ApolloPathConstants.SELECTOR_DATA_ID,
+ ApolloPathConstants.RULE_DATA_ID,
+ ApolloPathConstants.AUTH_DATA_ID,
+ ApolloPathConstants.META_DATA_ID,
+ ApolloPathConstants.PROXY_SELECTOR_DATA_ID,
+ ApolloPathConstants.DISCOVERY_DATA_ID));
+ this.apolloClient = apolloClient;
+ }
+
+ @Override
+ public void doPublishConfig(final String dataId, final Object data) {
+ this.apolloClient.createOrUpdateItem(dataId, data, "create config data");
+ this.apolloClient.publishNamespace("publish config data", "");
+ }
+
+ @Override
+ public String getConfig(final String dataId) {
+ return this.apolloClient.getItemValue(dataId);
+ }
+
+ @Override
+ public void doDelConfig(final String dataId) {
+ this.apolloClient.removeItemKey(dataId);
+ this.apolloClient.publishNamespace("delete config data", "");
+ }
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.factories b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..f210012
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.shenyu.admin.config.ApolloSyncConfiguration
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.provides b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..9893ff1
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+provides: shenyu-admin-listener-apollo
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000..cda1dd6
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shenyu.admin.config.ApolloSyncConfiguration
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/config/ApolloSyncConfigurationTest.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/config/ApolloSyncConfigurationTest.java
new file mode 100644
index 0000000..362aa64
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/config/ApolloSyncConfigurationTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.config;
+
+import org.apache.shenyu.admin.config.properties.ApolloProperties;
+import org.apache.shenyu.admin.listener.DataChangedInit;
+import org.apache.shenyu.admin.listener.DataChangedListener;
+import org.apache.shenyu.admin.service.SyncDataService;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.autoconfigure.AutoConfigurations;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+/**
+ * Auto-configuration contracts of the external Apollo Admin listener.
+ */
+class ApolloSyncConfigurationTest {
+
+ private final ApplicationContextRunner runner = new ApplicationContextRunner()
+ .withConfiguration(AutoConfigurations.of(ApolloSyncConfiguration.class))
+ .withBean(SyncDataService.class, () -> mock(SyncDataService.class));
+
+ @Test
+ void createsAdminBeansAndBindsExistingProperties() {
+ runner.withPropertyValues("shenyu.sync.apollo.meta=http://127.0.0.1:8080",
+ "shenyu.sync.apollo.portalUrl=http://127.0.0.1:8070", "shenyu.sync.apollo.appId=shenyu",
+ "shenyu.sync.apollo.env=DEV", "shenyu.sync.apollo.clusterName=default",
+ "shenyu.sync.apollo.namespace=application", "shenyu.sync.apollo.token=test-token")
+ .run(context -> {
+ assertThat(context).hasNotFailed().hasSingleBean(DataChangedListener.class).hasSingleBean(DataChangedInit.class);
+ assertThat(context.getBean(ApolloProperties.class).getAppId()).isEqualTo("shenyu");
+ assertThat(context.getBean(ApolloProperties.class).getNamespace()).isEqualTo("application");
+ });
+ }
+
+ @Test
+ void backsOffWhenApolloMetaIsAbsent() {
+ runner.run(context -> assertThat(context).hasNotFailed().doesNotHaveBean(DataChangedListener.class).doesNotHaveBean(DataChangedInit.class));
+ }
+}
diff --git a/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/listener/apollo/ApolloClientTest.java b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/listener/apollo/ApolloClientTest.java
new file mode 100644
index 0000000..feb1651
--- /dev/null
+++ b/shenyu-extension/shenyu-extension-apollo/shenyu-admin-listener-apollo/src/test/java/org/apache/shenyu/admin/listener/apollo/ApolloClientTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.listener.apollo;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.shenyu.admin.config.properties.ApolloProperties;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@ContextConfiguration(classes = {ApolloProperties.class})
+@RunWith(SpringJUnit4ClassRunner.class)
+public class ApolloClientTest {
+
+ @MockBean
+ private ApolloClient apolloClient;
+
+ /**
+ * Method under test: {@link ApolloClient#ApolloClient(ApolloProperties)}.
+ */
+ @Test
+ public void testConstructor() {
+ ApolloProperties apolloConfig = new ApolloProperties();
+ apolloConfig.setAppId("42");
+ apolloConfig.setClusterName("Cluster Name");
+ apolloConfig.setEnv("Env");
+ apolloConfig.setMeta("Meta");
+ apolloConfig.setNamespace("Namespace");
+ apolloConfig.setPortalUrl("http://localhost:8080");
+ apolloConfig.setToken("ABC123");
+ new ApolloClient(apolloConfig);
+ assertEquals("42", apolloConfig.getAppId());
+ assertEquals("ABC123", apolloConfig.getToken());
+ assertEquals("http://localhost:8080", apolloConfig.getPortalUrl());
+ assertEquals("Namespace", apolloConfig.getNamespace());
+ assertEquals("Meta", apolloConfig.getMeta());
+ assertEquals("Env", apolloConfig.getEnv());
+ assertEquals("Cluster Name", apolloConfig.getClusterName());
+ }
+
+ /**
+ * Method under test: {@link ApolloClient#getItemValue(String)}.
+ */
+ @Test
+ public void testGetItemValue() {
+ when(apolloClient.getItemValue(Mockito.any())).thenReturn("42");
+ assertEquals("42", apolloClient.getItemValue("Key"));
+ verify(apolloClient).getItemValue(Mockito.any());
+ }
+
+ /**
+ * Method under test: {@link ApolloClient#createOrUpdateItem(String, Object, String)}.
+ */
+ @Test
+ public void testCreateOrUpdateItem() {
+ doNothing().when(apolloClient)
+ .createOrUpdateItem(Mockito.any(), Mockito.