This is an automated email from the ASF dual-hosted git repository.
hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 6795ccdb9 [Task]sdk-examples-dubbo (#4166)
6795ccdb9 is described below
commit 6795ccdb96635604818c948e0fe6ab6b228a9585
Author: mahaitao <[email protected]>
AuthorDate: Wed Nov 9 16:07:24 2022 +0800
[Task]sdk-examples-dubbo (#4166)
* feat:add apache-sdk-dubbo exmaple
* feat:add sdk dubbo example
* feat:fix checkstyle problem
* feat:rollback bootstrap pom.xml
* feat:fix
Co-authored-by: mahaitao617 <[email protected]>
Co-authored-by: moremind <[email protected]>
---
shenyu-bootstrap/pom.xml | 2 +-
shenyu-examples/shenyu-examples-sdk/pom.xml | 1 +
.../{ => shenyu-examples-sdk-dubbo}/pom.xml | 47 ++---
.../Dockerfile | 29 +++
.../pom.xml | 120 +++++++++++++
.../src/main/http/sdk-apache-dubbo-test-api.http | 24 +++
.../ShenyuSdkApacheDubboExampleApplication.java} | 10 +-
.../consumer/api/ShenyuApacheDubboClientApi.java} | 27 ++-
.../ShenyuApacheDubboSdkExampleController.java} | 32 ++--
.../src/main/resources/application.yml | 52 ++++++
.../Dockerfile | 29 +++
.../pom.xml | 199 +++++++++++++++++++++
.../src/main/http/sdk-apache-dubbo-test-api.http | 24 +++
.../ShenyuApacheDubboXmlProviderApplication.java} | 12 +-
.../sdk/http/ShenyuSdkHttpExampleApplication.java | 2 +-
15 files changed, 538 insertions(+), 72 deletions(-)
diff --git a/shenyu-bootstrap/pom.xml b/shenyu-bootstrap/pom.xml
index 88d150633..9c2f6c394 100644
--- a/shenyu-bootstrap/pom.xml
+++ b/shenyu-bootstrap/pom.xml
@@ -493,7 +493,7 @@
<version>${project.version}</version>
</dependency>
<!--shenyu logging-kafka plugin end-->
-
+
<!--shenyu logging-elasticsearch plugin start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
diff --git a/shenyu-examples/shenyu-examples-sdk/pom.xml
b/shenyu-examples/shenyu-examples-sdk/pom.xml
index 8474393ad..e67c5d42f 100644
--- a/shenyu-examples/shenyu-examples-sdk/pom.xml
+++ b/shenyu-examples/shenyu-examples-sdk/pom.xml
@@ -29,6 +29,7 @@
<packaging>pom</packaging>
<modules>
<module>shenyu-examples-sdk-http</module>
+ <module>shenyu-examples-sdk-dubbo</module>
</modules>
<properties>
diff --git a/shenyu-examples/shenyu-examples-sdk/pom.xml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/pom.xml
similarity index 54%
copy from shenyu-examples/shenyu-examples-sdk/pom.xml
copy to shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/pom.xml
index 8474393ad..31d9d10e8 100644
--- a/shenyu-examples/shenyu-examples-sdk/pom.xml
+++ b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/pom.xml
@@ -15,55 +15,36 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>shenyu-examples</artifactId>
<groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-sdk</artifactId>
<version>2.5.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
-
- <artifactId>shenyu-examples-sdk</artifactId>
+ <artifactId>shenyu-examples-sdk-dubbo</artifactId>
<packaging>pom</packaging>
+
<modules>
- <module>shenyu-examples-sdk-http</module>
+ <module>shenyu-examples-sdk-apache-dubbo-consumer</module>
+ <module>shenyu-examples-sdk-apache-dubbo-provider</module>
</modules>
- <properties>
- <shenyu-sdk.version>2.5.1-SNAPSHOT</shenyu-sdk.version>
- </properties>
-
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-core</artifactId>
- <version>${shenyu-sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-spring</artifactId>
- <version>${shenyu-sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-httpclient</artifactId>
- <version>${shenyu-sdk.version}</version>
+ <artifactId>shenyu-examples-common</artifactId>
+ <version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-okhttp</artifactId>
- <version>${shenyu-sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-sdk</artifactId>
- <version>${shenyu-sdk.version}</version>
- </dependency>
-
+<!-- <dependency>-->
+<!-- <groupId>org.apache.shenyu</groupId>-->
+<!-- <artifactId>shenyu-examples-dubbo-api</artifactId>-->
+<!-- <version>${project.version}</version>-->
+<!-- </dependency>-->
</dependencies>
</dependencyManagement>
-
-</project>
\ No newline at end of file
+</project>
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/Dockerfile
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/Dockerfile
new file mode 100644
index 000000000..1cfc077e9
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/Dockerfile
@@ -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.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-examples-sdk-apache-dubbo-consumer
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 8899
+
+CMD java -jar ${APP_NAME}.jar
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/pom.xml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/pom.xml
new file mode 100644
index 000000000..b4a563012
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>shenyu-examples-sdk-dubbo</artifactId>
+ <groupId>org.apache.shenyu</groupId>
+ <version>2.5.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-examples-sdk-apache-dubbo-consumer</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-dubbo-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <!--spring bootstrap-->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-sdk</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-examples-sdk-apache-dubbo-consumer</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+
<mainClass>org.apache.shenyu.examples.sdk.apache.dubbo.consumer.ShenyuSdkApacheDubboExampleApplication</mainClass>
+ <executable>true</executable>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>example</id>
+ <properties>
+
<docker.buildArg.APP_NAME>shenyu-examples-sdk-apache-dubbo-consumer</docker.buildArg.APP_NAME>
+
<docker.image.tag.repo>shenyu-examples-sdk-apache-dubbo-consumer</docker.image.tag.repo>
+ <docker.image.tag.tagName>latest</docker.image.tag.tagName>
+ </properties>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+
<name>shenyu-examples-sdk-apache-dubbo-consumer</name>
+ <build>
+
<contextDir>${project.basedir}</contextDir>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/http/sdk-apache-dubbo-test-api.http
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/http/sdk-apache-dubbo-test-api.http
new file mode 100644
index 000000000..6c328bc98
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/http/sdk-apache-dubbo-test-api.http
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+### shengyu apache dubbo /sdk/dubbo/findAll
+GET http://localhost:8899/sdk/dubbo/findAll
+Accept: application/json
+Content-Type: application/json
+
+
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/ShenyuSdkApacheDubboExampleApplication.java
similarity index 77%
copy from
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
copy to
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/ShenyuSdkApacheDubboExampleApplication.java
index 50a0f0e0e..4d5827bb2 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/ShenyuSdkApacheDubboExampleApplication.java
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-package org.apache.shenyu.examples.sdk.http;
+package org.apache.shenyu.examples.sdk.apache.dubbo.consumer;
import org.apache.shenyu.sdk.spring.EnableShenyuClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
- * ShenyuSdkHttpExampleApplication.
+ * ShenyuSdkApacheDubboExampleApplication.
*/
@SpringBootApplication
-@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
-public class ShenyuSdkHttpExampleApplication {
+@EnableShenyuClients(basePackages =
"org.apache.shenyu.examples.sdk.apache.dubbo.api")
+public class ShenyuSdkApacheDubboExampleApplication {
/**
* main.
@@ -34,6 +34,6 @@ public class ShenyuSdkHttpExampleApplication {
* @param args args
*/
public static void main(final String[] args) {
- SpringApplication.run(ShenyuSdkHttpExampleApplication.class, args);
+ SpringApplication.run(ShenyuSdkApacheDubboExampleApplication.class,
args);
}
}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/api/ShenyuApacheDubboClientApi.java
similarity index 58%
copy from
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
copy to
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/api/ShenyuApacheDubboClientApi.java
index 50a0f0e0e..037ef0781 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/api/ShenyuApacheDubboClientApi.java
@@ -15,25 +15,24 @@
* limitations under the License.
*/
-package org.apache.shenyu.examples.sdk.http;
+package org.apache.shenyu.examples.sdk.apache.dubbo.consumer.api;
-import org.apache.shenyu.sdk.spring.EnableShenyuClients;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
+import org.apache.shenyu.sdk.spring.ShenyuClient;
+import org.springframework.web.bind.annotation.GetMapping;
/**
- * ShenyuSdkHttpExampleApplication.
+ * ShenyuHttpClientApi.
*/
-@SpringBootApplication
-@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
-public class ShenyuSdkHttpExampleApplication {
+@ShenyuClient(contextId = "shenyu-gateway", name = "ShenyuSdkApiName")
+public interface ShenyuApacheDubboClientApi {
/**
- * main.
- *
- * @param args args
+ * findAll.
+ * test Get.
+ * @return SdkTestDto
*/
- public static void main(final String[] args) {
- SpringApplication.run(ShenyuSdkHttpExampleApplication.class, args);
- }
+ @GetMapping("/dubbo/findAll")
+ DubboTest findAll();
+
}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/controller/ShenyuApacheDubboSdkExampleController.java
similarity index 51%
copy from
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
copy to
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/controller/ShenyuApacheDubboSdkExampleController.java
index 50a0f0e0e..8ae79840e 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/java/org/apache/shenyu/examples/sdk/apache/dubbo/consumer/controller/ShenyuApacheDubboSdkExampleController.java
@@ -15,25 +15,31 @@
* limitations under the License.
*/
-package org.apache.shenyu.examples.sdk.http;
+package org.apache.shenyu.examples.sdk.apache.dubbo.consumer.controller;
-import org.apache.shenyu.sdk.spring.EnableShenyuClients;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.apache.shenyu.examples.dubbo.api.entity.DubboTest;
+import
org.apache.shenyu.examples.sdk.apache.dubbo.consumer.api.ShenyuApacheDubboClientApi;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
- * ShenyuSdkHttpExampleApplication.
+ * ShenyuHttpSdkExampleController.
+ * invoke shenyuSdkAPi
*/
-@SpringBootApplication
-@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
-public class ShenyuSdkHttpExampleApplication {
+@RestController
+public class ShenyuApacheDubboSdkExampleController {
+
+ @Autowired
+ private ShenyuApacheDubboClientApi shenyuApacheDubboClientApi;
/**
- * main.
- *
- * @param args args
+ * findAll.
+ * @return SdkTestDto
*/
- public static void main(final String[] args) {
- SpringApplication.run(ShenyuSdkHttpExampleApplication.class, args);
+ @GetMapping("sdk/dubbo/findAll")
+ public DubboTest findAll() {
+ return shenyuApacheDubboClientApi.findAll();
}
+
}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/resources/application.yml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/resources/application.yml
new file mode 100644
index 000000000..404c6aeda
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-consumer/src/main/resources/application.yml
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+server:
+ port: 8899
+ address: 0.0.0.0
+ tomcat:
+ max-http-form-post-size: 100MB
+
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ dubbo:
+ props:
+ contextPath: /http
+ appName: http
+ # port: 8189
+ sdk:
+ enabled: true
+ register-type: zookeeper #local #etcd #nacos #consul
+ server-lists: localhost:2181 #http://localhost:9095 #http://localhost:2379
#localhost:8848
+
+spring:
+ servlet:
+ multipart:
+ max-file-size: 100MB
+ max-request-size: 100MB
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.test.bonuspoint: info
+ org.apache.shenyu.test.lottery: debug
+ org.apache.shenyu.test: debug
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/Dockerfile
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/Dockerfile
new file mode 100644
index 000000000..6d2a66a1d
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/Dockerfile
@@ -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.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-examples-sdk-apache-dubbo-provider
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 8011
+
+CMD java -jar ${APP_NAME}.jar
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/pom.xml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/pom.xml
new file mode 100644
index 000000000..ab15fc11c
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/pom.xml
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-sdk-dubbo</artifactId>
+ <version>2.5.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>shenyu-examples-sdk-apache-dubbo-provider</artifactId>
+
+ <properties>
+ <curator.version>5.2.1</curator.version>
+ <nacos-client.version>2.0.4</nacos-client.version>
+ <apache.dubbo.version>2.7.15</apache.dubbo.version>
+ <zookeeper.version>3.6.3</zookeeper.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-client-apache-dubbo</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!--shenyu consul register center -->
+ <!--<dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-consul-discovery</artifactId>
+ <version>2.2.6.RELEASE</version>
+ </dependency>-->
+
+<!-- <dependency>-->
+<!-- <groupId>org.apache.shenyu</groupId>-->
+<!-- <artifactId>shenyu-examples-dubbo-api</artifactId>-->
+<!-- </dependency>-->
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ </dependency>
+
+ <!-- Dubbo dependency -->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${apache.dubbo.version}</version>
+ </dependency>
+
+ <!--
https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-registry-nacos -->
+ <!-- Dubbo Nacos registry dependency -->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${apache.dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-apache-dubbo-service-xml</artifactId>
+ <version>2.5.1-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Keep latest Nacos client version -->
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos-client.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-client</artifactId>
+ <version>${curator.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-framework</artifactId>
+ <version>${curator.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-recipes</artifactId>
+ <version>${curator.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>${zookeeper.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>org.apache.shenyu</groupId>-->
+<!-- <artifactId>shenyu-examples-dubbo-api</artifactId>-->
+<!-- <version>2.5.1-SNAPSHOT</version>-->
+<!-- </dependency>-->
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-examples-sdk-apache-dubbo-provider</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+
<mainClass>org.apache.shenyu.examples.sdk.apache.provider.ShenyuApacheDubboXmlProviderApplication</mainClass>
+ <executable>true</executable>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>example</id>
+ <properties>
+
<docker.buildArg.APP_NAME>shenyu-examples-sdk-apache-dubbo-provider</docker.buildArg.APP_NAME>
+
<docker.image.tag.repo>shenyu-examples-sdk-apache-dubbo-provider</docker.image.tag.repo>
+ <docker.image.tag.tagName>latest</docker.image.tag.tagName>
+ </properties>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+
<name>shenyu-examples-sdk-apache-dubbo-provider</name>
+ <build>
+
<contextDir>${project.basedir}</contextDir>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/http/sdk-apache-dubbo-test-api.http
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/http/sdk-apache-dubbo-test-api.http
new file mode 100644
index 000000000..6c328bc98
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/http/sdk-apache-dubbo-test-api.http
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+### shengyu apache dubbo /sdk/dubbo/findAll
+GET http://localhost:8899/sdk/dubbo/findAll
+Accept: application/json
+Content-Type: application/json
+
+
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/java/org/apache/shenyu/examples/sdk/apache/provider/ShenyuApacheDubboXmlProviderApplication.java
similarity index 69%
copy from
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
copy to
shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/java/org/apache/shenyu/examples/sdk/apache/provider/ShenyuApacheDubboXmlProviderApplication.java
index 50a0f0e0e..5f0f761a4 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-dubbo/shenyu-examples-sdk-apache-dubbo-provider/src/main/java/org/apache/shenyu/examples/sdk/apache/provider/ShenyuApacheDubboXmlProviderApplication.java
@@ -15,18 +15,20 @@
* limitations under the License.
*/
-package org.apache.shenyu.examples.sdk.http;
+package org.apache.shenyu.examples.sdk.apache.provider;
-import org.apache.shenyu.sdk.spring.EnableShenyuClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ImportResource;
/**
* ShenyuSdkHttpExampleApplication.
*/
@SpringBootApplication
-@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
-public class ShenyuSdkHttpExampleApplication {
+@ImportResource({"classpath:spring-dubbo.xml", "classpath:shenyu.xml"})
+@ComponentScan(basePackages =
"org.apache.shenyu.examples.apache.dubbo.service.xml.impl")
+public class ShenyuApacheDubboXmlProviderApplication {
/**
* main.
@@ -34,6 +36,6 @@ public class ShenyuSdkHttpExampleApplication {
* @param args args
*/
public static void main(final String[] args) {
- SpringApplication.run(ShenyuSdkHttpExampleApplication.class, args);
+ SpringApplication.run(ShenyuApacheDubboXmlProviderApplication.class,
args);
}
}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
index 50a0f0e0e..23322fce5 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
@@ -25,7 +25,7 @@ import
org.springframework.boot.autoconfigure.SpringBootApplication;
* ShenyuSdkHttpExampleApplication.
*/
@SpringBootApplication
-@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
+@EnableShenyuClients(basePackages = "org.apache.shenyu.examples.sdk.http.api")
public class ShenyuSdkHttpExampleApplication {
/**