This is an automated email from the ASF dual-hosted git repository. liujun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push: new 25b39acb7 Add nacos and gateway examples (#1143) 25b39acb7 is described below commit 25b39acb73f7c559859626f4b5a7ad299f85654e Author: Ken Liu <ken.lj...@gmail.com> AuthorDate: Sat Apr 27 12:46:27 2024 +0800 Add nacos and gateway examples (#1143) --- 1-basic/dubbo-samples-spring-boot-idl/README.md | 8 +- .../springboot/demo/idl/DubboGreeterTriple.java | 41 ++++-- .../apache/dubbo/springboot/demo/idl/Greeter.java | 24 +--- .../dubbo-samples-spring-boot-idl-consumer/pom.xml | 2 +- .../src/main/resources/application.yml | 2 +- .../springboot/demo/idl/DubboGreeterTriple.java | 41 ++++-- .../apache/dubbo/springboot/demo/idl/Greeter.java | 24 +--- .../dubbo-samples-spring-boot-idl-provider/pom.xml | 2 +- .../src/main/resources/application.yml | 2 +- 1-basic/dubbo-samples-spring-boot-idl/pom.xml | 2 +- 1-basic/dubbo-samples-spring-boot/README.md | 8 +- .../case-configuration.yml | 26 +++- ...ase-versions.conf => case-version-sources.conf} | 9 +- .../dubbo-samples-spring-boot/case-versions.conf | 1 + .../dubbo-samples-spring-boot-consumer/pom.xml | 16 +-- .../src/main/resources/application.yml | 2 +- .../dubbo-samples-spring-boot-provider/pom.xml | 16 +-- .../src/main/resources/application.yml | 2 +- 1-basic/dubbo-samples-spring-boot/pom.xml | 2 +- .../dubbo-samples-gateway-apisix-dubbo/README.md | 20 ++- .../pom.xml | 12 ++ .../consumer/ConsumerApplication.java | 2 +- .../gateway/{ => apisix.dubbo}/consumer/Task.java | 4 +- .../api/ApisixService.java | 2 +- .../api/DemoService.java | 2 +- .../pom.xml | 8 ++ .../provider/ApisixServiceImpl.java | 4 +- .../provider/DemoServiceImpl.java | 4 +- .../provider/ProviderApplication.java | 2 +- .../src/main/resources/application.yml | 3 +- .../dubbo-samples-gateway-apisix-dubbo/pom.xml | 2 +- .../dubbo-samples-gateway-apisix-triple/README.md | 1 + .../docker-compose.yml | 118 +++++++++++++++++ .../dubbo-samples-gateway-apisix-triple}/pom.xml | 20 +-- .../dubbo/samples/gateway/apisix}/DemoService.java | 4 +- .../gateway/apisix}/ProviderApplication.java | 4 +- .../gateway/apisix/impl}/DemoServiceImpl.java | 8 +- .../src/main/resources/application.yml | 19 ++- .../src/main/resources/log4j2.xml | 29 +++++ .../dubbo-samples-gateway-apisix/pom.xml | 139 +++++++++++++++------ .../dubbo-samples-gateway-higress-dubbo/README.md | 1 + .../dubbo-proxy/proxy-interface-registry.yaml | 91 ++++++++++++++ .../deploy/dubbo-proxy/proxy.yaml | 91 ++++++++++++++ .../ingress/Ingress-interface-registry.yaml} | 10 +- .../deploy/ingress/Ingress.yaml | 28 +++-- .../deploy/mcp/mcpbridge.yml | 21 ++-- .../deploy/nacos/Nacos.yaml} | 67 ++++++---- .../deploy/provider/Deployment.yaml | 4 +- .../pom.xml | 18 ++- .../gateway/consumer/ConsumerApplication.java | 1 - .../dubbo/samples/gateway/consumer/task}/Task.java | 24 +--- .../src/main/resources/application.yml | 15 ++- .../src/main/resources/log4j2.xml | 29 +++++ .../pom.xml | 36 ++---- .../dubbo/samples/gateway}/api/DemoService.java | 4 +- .../Dockerfile} | 18 +-- .../pom.xml | 18 ++- .../gateway/provider/ProviderApplication.java | 2 + .../gateway/provider/impl}/DemoServiceImpl.java | 8 +- .../src/main/resources/application.yml | 19 ++- .../src/main/resources/log4j2.xml | 29 +++++ .../pom.xml | 48 +------ .../dubbo-samples-gateway-higress-triple/README.md | 1 + .../deploy/ingress/Ingress.yaml | 10 +- .../deploy/mcp/mcpbridge.yml | 21 ++-- .../{provider/Deployment.yaml => nacos/Nacos.yaml} | 67 ++++++---- .../deploy/provider/Deployment.yaml | 2 +- .../pom.xml | 12 ++ .../dubbo/samples/gateway/api/DemoService.java | 2 +- .../pom.xml | 12 ++ .../dubbo-samples-gateway-higress-triple/pom.xml | 40 +----- .../dubbo-samples-gateway-higress/pom.xml | 1 + 2-advanced/dubbo-samples-gateway/pom.xml | 2 +- .../dubbo-samples-nacos-registry/pom.xml | 80 +++++------- .../registry/dubbo-samples-zookeeper/pom.xml | 2 +- 75 files changed, 980 insertions(+), 491 deletions(-) diff --git a/1-basic/dubbo-samples-spring-boot-idl/README.md b/1-basic/dubbo-samples-spring-boot-idl/README.md index 80b979831..7ff698dbc 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/README.md +++ b/1-basic/dubbo-samples-spring-boot-idl/README.md @@ -4,10 +4,10 @@ This example uses triple as the underlying RPC protocol and IDL to define servic # How to run -## Start Zookeeper -This example replies on Zookeeper(3.8.0+) as service discovery registry center, so you need to run the Zookeeper server first, there are two ways to do so: -1. [Download zookeeper binary and start it directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#本地下载) -2. [Start zookeeper using docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#docker) +## Start Nacos +This example replies on Nacos as service discovery registry center, so you need to run the Nacos server first, there are two ways to do so: +1. [Download Nacos binary and start it directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/nacos/#本地下载) +2. [Start Nacos using docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/nacos/#docker) ## Compile diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java index adfe66bea..48eba35df 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java @@ -15,7 +15,7 @@ * limitations under the License. */ - package org.apache.dubbo.springboot.demo.idl; +package org.apache.dubbo.springboot.demo.idl; import org.apache.dubbo.common.stream.StreamObserver; import org.apache.dubbo.common.URL; @@ -63,23 +63,27 @@ public final class DubboGreeterTriple { } private static final StubMethodDescriptor greetMethod = new StubMethodDescriptor("greet", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); private static final StubMethodDescriptor greetAsyncMethod = new StubMethodDescriptor("greet", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); private static final StubMethodDescriptor greetProxyAsyncMethod = new StubMethodDescriptor("greetAsync", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); + static{ + serviceDescriptor.addMethod(greetMethod); + serviceDescriptor.addMethod(greetProxyAsyncMethod); + } public static class GreeterStub implements Greeter{ private final Invoker<Greeter> invoker; @@ -97,7 +101,6 @@ public final class DubboGreeterTriple { return StubInvocationUtil.unaryCall(invoker, greetAsyncMethod, request); } - @Override public void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ StubInvocationUtil.unaryCall(invoker, greetMethod , request, responseObserver); } @@ -123,6 +126,26 @@ public final class DubboGreeterTriple { }; } + @Override + public CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){ + return CompletableFuture.completedFuture(greet(request)); + } + + /** + * This server stream type unary method is <b>only</b> used for generated stub to support async unary method. + * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method. + */ + public void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ + greetAsync(request).whenComplete((r, t) -> { + if (t != null) { + responseObserver.onError(t); + } else { + responseObserver.onNext(r); + responseObserver.onCompleted(); + } + }); + } + @Override public final Invoker<Greeter> getInvoker(URL url) { PathResolver pathResolver = url.getOrDefaultFrameworkModel() @@ -130,8 +153,12 @@ public final class DubboGreeterTriple { .getDefaultExtension(); Map<String,StubMethodHandler<?, ?>> handlers = new HashMap<>(); - pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greet" ); - pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greetAsync" ); + pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greet"); + pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greetAsync"); + // for compatibility + pathResolver.addNativeStub( "/" + JAVA_SERVICE_NAME + "/greet"); + pathResolver.addNativeStub( "/" + JAVA_SERVICE_NAME + "/greetAsync"); + BiConsumer<org.apache.dubbo.springboot.demo.idl.GreeterRequest, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply>> greetFunc = this::greet; handlers.put(greetMethod.getMethodName(), new UnaryStubMethodHandler<>(greetFunc)); diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java index c109cc318..14d1c2bcf 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java @@ -15,7 +15,7 @@ * limitations under the License. */ - package org.apache.dubbo.springboot.demo.idl; +package org.apache.dubbo.springboot.demo.idl; import org.apache.dubbo.common.stream.StreamObserver; import com.google.protobuf.Message; @@ -29,27 +29,11 @@ public interface Greeter extends org.apache.dubbo.rpc.model.DubboStub { String JAVA_SERVICE_NAME = "org.apache.dubbo.springboot.demo.idl.Greeter"; String SERVICE_NAME = "org.apache.dubbo.springboot.demo.idl.Greeter"; - org.apache.dubbo.springboot.demo.idl.GreeterReply greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request); - default CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){ - return CompletableFuture.completedFuture(greet(request)); - } - - /** - * This server stream type unary method is <b>only</b> used for generated stub to support async unary method. - * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method. - */ - default void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ - greetAsync(request).whenComplete((r, t) -> { - if (t != null) { - responseObserver.onError(t); - } else { - responseObserver.onNext(r); - responseObserver.onCompleted(); - } - }); - } + CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request); + + diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/pom.xml b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/pom.xml index d06db4b99..0a75b4e69 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/pom.xml +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/pom.xml @@ -35,7 +35,7 @@ </dependency> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> <!-- spring starter --> diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml index 835922e34..af2a2545a 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml @@ -19,4 +19,4 @@ dubbo: name: dubbo-springboot-demo-consumer logger: slf4j registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + address: nacos://${nacos.address:127.0.0.1}:8848?username=nacos&password=nacos diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java index adfe66bea..48eba35df 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/DubboGreeterTriple.java @@ -15,7 +15,7 @@ * limitations under the License. */ - package org.apache.dubbo.springboot.demo.idl; +package org.apache.dubbo.springboot.demo.idl; import org.apache.dubbo.common.stream.StreamObserver; import org.apache.dubbo.common.URL; @@ -63,23 +63,27 @@ public final class DubboGreeterTriple { } private static final StubMethodDescriptor greetMethod = new StubMethodDescriptor("greet", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); private static final StubMethodDescriptor greetAsyncMethod = new StubMethodDescriptor("greet", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); private static final StubMethodDescriptor greetProxyAsyncMethod = new StubMethodDescriptor("greetAsync", - org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY, + org.apache.dubbo.springboot.demo.idl.GreeterRequest.class, org.apache.dubbo.springboot.demo.idl.GreeterReply.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.springboot.demo.idl.GreeterRequest::parseFrom, org.apache.dubbo.springboot.demo.idl.GreeterReply::parseFrom); + static{ + serviceDescriptor.addMethod(greetMethod); + serviceDescriptor.addMethod(greetProxyAsyncMethod); + } public static class GreeterStub implements Greeter{ private final Invoker<Greeter> invoker; @@ -97,7 +101,6 @@ public final class DubboGreeterTriple { return StubInvocationUtil.unaryCall(invoker, greetAsyncMethod, request); } - @Override public void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ StubInvocationUtil.unaryCall(invoker, greetMethod , request, responseObserver); } @@ -123,6 +126,26 @@ public final class DubboGreeterTriple { }; } + @Override + public CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){ + return CompletableFuture.completedFuture(greet(request)); + } + + /** + * This server stream type unary method is <b>only</b> used for generated stub to support async unary method. + * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method. + */ + public void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ + greetAsync(request).whenComplete((r, t) -> { + if (t != null) { + responseObserver.onError(t); + } else { + responseObserver.onNext(r); + responseObserver.onCompleted(); + } + }); + } + @Override public final Invoker<Greeter> getInvoker(URL url) { PathResolver pathResolver = url.getOrDefaultFrameworkModel() @@ -130,8 +153,12 @@ public final class DubboGreeterTriple { .getDefaultExtension(); Map<String,StubMethodHandler<?, ?>> handlers = new HashMap<>(); - pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greet" ); - pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greetAsync" ); + pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greet"); + pathResolver.addNativeStub( "/" + SERVICE_NAME + "/greetAsync"); + // for compatibility + pathResolver.addNativeStub( "/" + JAVA_SERVICE_NAME + "/greet"); + pathResolver.addNativeStub( "/" + JAVA_SERVICE_NAME + "/greetAsync"); + BiConsumer<org.apache.dubbo.springboot.demo.idl.GreeterRequest, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply>> greetFunc = this::greet; handlers.put(greetMethod.getMethodName(), new UnaryStubMethodHandler<>(greetFunc)); diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java index c109cc318..14d1c2bcf 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/build/generated/source/proto/main/java/org/apache/dubbo/springboot/demo/idl/Greeter.java @@ -15,7 +15,7 @@ * limitations under the License. */ - package org.apache.dubbo.springboot.demo.idl; +package org.apache.dubbo.springboot.demo.idl; import org.apache.dubbo.common.stream.StreamObserver; import com.google.protobuf.Message; @@ -29,27 +29,11 @@ public interface Greeter extends org.apache.dubbo.rpc.model.DubboStub { String JAVA_SERVICE_NAME = "org.apache.dubbo.springboot.demo.idl.Greeter"; String SERVICE_NAME = "org.apache.dubbo.springboot.demo.idl.Greeter"; - org.apache.dubbo.springboot.demo.idl.GreeterReply greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request); - default CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){ - return CompletableFuture.completedFuture(greet(request)); - } - - /** - * This server stream type unary method is <b>only</b> used for generated stub to support async unary method. - * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method. - */ - default void greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request, StreamObserver<org.apache.dubbo.springboot.demo.idl.GreeterReply> responseObserver){ - greetAsync(request).whenComplete((r, t) -> { - if (t != null) { - responseObserver.onError(t); - } else { - responseObserver.onNext(r); - responseObserver.onCompleted(); - } - }); - } + CompletableFuture<org.apache.dubbo.springboot.demo.idl.GreeterReply> greetAsync(org.apache.dubbo.springboot.demo.idl.GreeterRequest request); + + diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/pom.xml b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/pom.xml index 1dacc74c2..178474ec6 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/pom.xml +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/pom.xml @@ -35,7 +35,7 @@ </dependency> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> <!-- spring starter --> diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml index 4ee1f02b6..f9c0db864 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml +++ b/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml @@ -22,4 +22,4 @@ dubbo: name: tri port: 50052 registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + address: nacos://${nacos.address:127.0.0.1}:8848?username=nacos&password=nacos diff --git a/1-basic/dubbo-samples-spring-boot-idl/pom.xml b/1-basic/dubbo-samples-spring-boot-idl/pom.xml index fb6f06db0..6dba99d5e 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/pom.xml +++ b/1-basic/dubbo-samples-spring-boot-idl/pom.xml @@ -40,7 +40,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dubbo.version>3.3.0-beta.1</dubbo.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <spring-boot.version>3.2.3</spring-boot.version> <protobuf-java.version>3.19.6</protobuf-java.version> <protoc.version>3.22.3</protoc.version> diff --git a/1-basic/dubbo-samples-spring-boot/README.md b/1-basic/dubbo-samples-spring-boot/README.md index 3e6d69241..441831d41 100644 --- a/1-basic/dubbo-samples-spring-boot/README.md +++ b/1-basic/dubbo-samples-spring-boot/README.md @@ -14,10 +14,10 @@ Please refer to # How to run -## Start Zookeeper -This example replies on Zookeeper(3.8.0+) as service discovery registry center, so you need to run the Zookeeper server first, there are two ways to do so: -1. [Download zookeeper binary and start it directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#本地下载) -2. [Start zookeeper using docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#docker) +## Start Nacos +This example replies on Nacos as service discovery registry center, so you need to run the Nacos server first, there are two ways to do so: +1. [Download Nacos binary and start it directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/nacos/#本地下载) +2. [Start Nacos using docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/nacos/#docker) ## Install dependencies Step into 'dubbo-samples-spring-boot' directory, run the following command: diff --git a/1-basic/dubbo-samples-spring-boot/case-configuration.yml b/1-basic/dubbo-samples-spring-boot/case-configuration.yml index b1721bc04..ece9c2dde 100644 --- a/1-basic/dubbo-samples-spring-boot/case-configuration.yml +++ b/1-basic/dubbo-samples-spring-boot/case-configuration.yml @@ -15,19 +15,33 @@ # limitations under the License. services: - zookeeper: - image: zookeeper:latest + nacos: + image: nacos/nacos-server:${nacos-server.version:2.0.0} + environment: + - PREFER_HOST_MODE=hostname + - MODE=standalone + - NACOS_AUTH_ENABLE=true + - JVM_XMS=512m + - JVM_XMX=512m + - JVM_XMN=256m + healthcheck: + test: 'curl -Ss http://localhost:8848/nacos' + interval: 5s + timeout: 5s + retries: 40 provider: type: app basedir: dubbo-samples-spring-boot-provider mainClass: org.apache.dubbo.springboot.demo.provider.ProviderApplication systemProps: - - zookeeper.address=zookeeper + - nacos.address=nacos waitPortsBeforeRun: - - zookeeper:2181 + - nacos:8848 checkPorts: - 50052 + depends_on: + - nacos checkLog: "Current Spring Boot Application is await..." test: @@ -36,9 +50,9 @@ services: tests: - "**/*IT.class" systemProps: - - zookeeper.address=zookeeper + - nacos.address=nacos waitPortsBeforeRun: - - zookeeper:2181 + - nacos:8848 - provider:50052 depends_on: - provider diff --git a/1-basic/dubbo-samples-spring-boot/case-versions.conf b/1-basic/dubbo-samples-spring-boot/case-version-sources.conf similarity index 81% copy from 1-basic/dubbo-samples-spring-boot/case-versions.conf copy to 1-basic/dubbo-samples-spring-boot/case-version-sources.conf index 82aeb4560..5b1472ab3 100644 --- a/1-basic/dubbo-samples-spring-boot/case-versions.conf +++ b/1-basic/dubbo-samples-spring-boot/case-version-sources.conf @@ -16,10 +16,5 @@ # limitations under the License. # - -# Supported component versions of the test case - -# Spring app -dubbo.version=3.3.* -spring.version=6.* -java.version= [>= 17] +nacos.version=https://repo1.maven.org/maven2/com/alibaba/nacos/nacos-client/maven-metadata.xml +#nacos-server.version=https://hub.docker.com/v2/namespaces/nacos/repositories/nacos-server/tags \ No newline at end of file diff --git a/1-basic/dubbo-samples-spring-boot/case-versions.conf b/1-basic/dubbo-samples-spring-boot/case-versions.conf index 82aeb4560..67f3eaef3 100644 --- a/1-basic/dubbo-samples-spring-boot/case-versions.conf +++ b/1-basic/dubbo-samples-spring-boot/case-versions.conf @@ -23,3 +23,4 @@ dubbo.version=3.3.* spring.version=6.* java.version= [>= 17] +nacos.version="!*-BETA","!*-ALPHA*",2.* diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/pom.xml b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/pom.xml index e88dbf25d..bfd906434 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/pom.xml +++ b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/pom.xml @@ -41,21 +41,7 @@ </dependency> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId> - <exclusions> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>*</artifactId> - </exclusion> - <exclusion> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - </exclusion> - <exclusion> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </exclusion> - </exclusions> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> <!-- spring starter --> diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml index f0c03c026..63c677077 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml +++ b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml @@ -20,4 +20,4 @@ dubbo: logger: slf4j qos-port: 33333 registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + address: nacos://${nacos.address:127.0.0.1}:8848?username=nacos&password=nacos diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/pom.xml b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/pom.xml index 0633cc76f..94ccb5d0b 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/pom.xml +++ b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/pom.xml @@ -41,21 +41,7 @@ </dependency> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId> - <exclusions> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>*</artifactId> - </exclusion> - <exclusion> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - </exclusion> - <exclusion> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </exclusion> - </exclusions> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> <!-- spring starter --> diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/src/main/resources/application.yml b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/src/main/resources/application.yml index 94860ea9b..56089736f 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/src/main/resources/application.yml +++ b/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider/src/main/resources/application.yml @@ -22,4 +22,4 @@ dubbo: name: tri port: 50052 registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + address: nacos://${nacos.address:127.0.0.1}:8848?username=nacos&password=nacos diff --git a/1-basic/dubbo-samples-spring-boot/pom.xml b/1-basic/dubbo-samples-spring-boot/pom.xml index cdbeca7c6..7c34f7443 100644 --- a/1-basic/dubbo-samples-spring-boot/pom.xml +++ b/1-basic/dubbo-samples-spring-boot/pom.xml @@ -40,7 +40,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dubbo.version>3.3.0-beta.1</dubbo.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <spring-boot.version>3.2.3</spring-boot.version> </properties> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md index fb34b3d3a..9682ced91 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/README.md @@ -12,7 +12,7 @@ You can choose any of the following ways to install APISIX: This document uses Docker installation, which is relatively simple -To install APISIX using this method, you need to install [Docker](https://www.docker.com/) And +To install APISIX using this method, you need to install [Docker](https://www.docker.com/) And [docker-compose](https://docs.docker.com/compose/) @@ -35,11 +35,11 @@ plugins: - dubbo-proxy ``` -Then note that due to the need to connect to the Nacos registry, it is necessary to modify the +Then note that due to the need to connect to the Nacos registry, it is necessary to modify the `cd apisix-docker/example` -`vi docker-compose.yml` +`vi docker-compose.yml` Add the following content ```yaml @@ -56,7 +56,7 @@ Add the following content apisix: ``` -Finally, use Docker Compose to enable APISIX: +Finally, use Docker Compose to enable APISIX: `docker-compose -p docker-apisix up -d` @@ -66,17 +66,15 @@ The code example can use the `dubbo-samples-gateway-apisix-dubbo` module under t Create an Upstream pointing to Dubbo Provider using curl. ```yaml -curl [http://127.0.0.1:9180/apisix/admin/upstreams/1](http://127.0.0.1:9180/apisix/admin/upstreams/1) -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +curl http://127.0.0.1:9180/apisix/admin/upstreams/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { - "nodes": { - "10.21.32.168:20880": 1 - }, + "service_name": "gateway-apisix-dubbo", "type": "roundrobin", "discovery_type": "nacos" }' ``` -Expose an HTTP route for ApisixService +Expose an HTTP route for ApisixService, the following configuration will forward requests starting with `/dubbo` to backend dubbo service `org.apache.dubbo.samples.api.ApisixService` and method `apisixDubbo`. ```yaml curl [http://127.0.0.1:9180/apisix/admin/routes/1](http://127.0.0.1:9180/apisix/admin/routes/1) -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' @@ -86,7 +84,7 @@ curl [http://127.0.0.1:9180/apisix/admin/routes/1](http://127.0.0.1:9180/apisix/ ], "plugins": { "dubbo-proxy": { - "service_name": "org.apache.dubbo.samples.api.ApisixService", + "service_name": "org.apache.dubbo.samples.gateway.apisix.dubboapi.ApisixService", "service_version": "0.0.0", "method": "apisixToDubbo" } @@ -112,4 +110,4 @@ Key = accept, Value = text/html,application/json,application/xhtml+xml,applicati Key = user-agent, Value = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/53 ``` -At this point, the most basic use of the Apisix proxy dubbo service sample has been completed \ No newline at end of file +At this point, the most basic use of the Apisix proxy dubbo service sample has been completed diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml index 8fcf57393..78c5ed5a6 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/pom.xml @@ -42,6 +42,10 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> + </dependency> <!-- spring starter --> <dependency> @@ -66,6 +70,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/ConsumerApplication.java similarity index 94% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/ConsumerApplication.java index 5cac7b9b2..33167592b 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/ConsumerApplication.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.consumer; +package org.apache.dubbo.samples.gateway.apisix.dubbo.consumer; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/Task.java similarity index 92% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/Task.java index aee203409..73abebc26 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/consumer/Task.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.consumer; +package org.apache.dubbo.samples.gateway.apisix.dubbo.consumer; import org.apache.dubbo.config.annotation.DubboReference; -import org.apache.dubbo.samples.api.DemoService; +import org.apache.dubbo.samples.gateway.apisix.dubbo.api.DemoService; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import java.util.Date; diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/ApisixService.java similarity index 94% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/ApisixService.java index cd71f6a11..aacd6b979 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/ApisixService.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/ApisixService.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.api; +package org.apache.dubbo.samples.gateway.apisix.dubbo.api; import java.util.Map; diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/DemoService.java similarity index 93% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/DemoService.java index 202775d89..ac33c9546 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway.apisix.dubbo/api/DemoService.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.api; +package org.apache.dubbo.samples.gateway.apisix.dubbo.api; public interface DemoService { diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml index 1e151d569..7debc9410 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/pom.xml @@ -93,6 +93,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ApisixServiceImpl.java similarity index 92% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ApisixServiceImpl.java index ebc5bcc0b..99f052ce4 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ApisixServiceImpl.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ApisixServiceImpl.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.apisix.dubbo.provider; import org.apache.dubbo.config.annotation.DubboService; -import org.apache.dubbo.samples.api.ApisixService; +import org.apache.dubbo.samples.gateway.apisix.dubbo.api.ApisixService; import java.util.HashMap; import java.util.Map; diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/DemoServiceImpl.java similarity index 88% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/DemoServiceImpl.java index e875f4d0d..1a6eae892 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/DemoServiceImpl.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.apisix.dubbo.provider; import org.apache.dubbo.config.annotation.DubboService; -import org.apache.dubbo.samples.api.DemoService; +import org.apache.dubbo.samples.gateway.apisix.dubbo.api.DemoService; @DubboService diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ProviderApplication.java similarity index 94% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ProviderApplication.java index 6c6f9e806..eb5a6cb48 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/apisix.dubbo/provider/ProviderApplication.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.apisix.dubbo.provider; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml index af3290405..6924538ba 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml @@ -16,11 +16,10 @@ server: port: 8888 dubbo: application: - name: dubbo-gateway-provider + name: gateway-apisix-dubbo protocol: name: dubbo port: 20880 - serialization: fastjson2 registry: address: nacos://${nacos.address:127.0.0.1}:8848 username: nacos diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml index 21cd99fec..fe9ac7df9 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/pom.xml @@ -37,7 +37,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring-boot.version>3.2.3</spring-boot.version> - <dubbo.version>3.3.0-beta.1</dubbo.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <dubbo-nacos.version>3.2.0</dubbo-nacos.version> </properties> <modules> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/README.md b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/README.md new file mode 100644 index 000000000..99f381570 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/README.md @@ -0,0 +1 @@ +Please visit [the official website](http://dubbo.apache.org/zh-cn/blog/2024/04/22/%E4%BD%BF%E7%94%A8-apache-apisix-%E4%BB%A3%E7%90%86-dubbo-%E6%9C%8D%E5%8A%A1triple%E5%8D%8F%E8%AE%AE/) for more details of this example. diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/docker-compose.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/docker-compose.yml new file mode 100644 index 000000000..779faa49f --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/docker-compose.yml @@ -0,0 +1,118 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +version: "3" + +services: + apisix: + image: apache/apisix:${APISIX_IMAGE_TAG:-3.9.0-debian} + restart: always + volumes: + - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro + depends_on: + - etcd + ##network_mode: host + ports: + - "9180:9180/tcp" + - "9080:9080/tcp" + - "9091:9091/tcp" + - "9443:9443/tcp" + - "9092:9092/tcp" + networks: + apisix: + + etcd: + image: bitnami/etcd:3.5.11 + restart: always + volumes: + - etcd_data:/bitnami/etcd + environment: + ETCD_ENABLE_V2: "true" + ALLOW_NONE_AUTHENTICATION: "yes" + ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379" + ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" + ports: + - "2379:2379/tcp" + networks: + apisix: + + + nacos: + image: nacos/nacos-server:v2.1.1 + container_name: nacos-standalone + environment: + - PREFER_HOST_MODE=hostname + - MODE=standalone + ports: + - "8848:8848" + - "9848:9848" + networks: + apisix: + + web1: + image: nginx:1.19.0-alpine + restart: always + volumes: + - ./upstream/web1.conf:/etc/nginx/nginx.conf + ports: + - "9081:80/tcp" + environment: + - NGINX_PORT=80 + networks: + apisix: + + web2: + image: nginx:1.19.0-alpine + restart: always + volumes: + - ./upstream/web2.conf:/etc/nginx/nginx.conf + ports: + - "9082:80/tcp" + environment: + - NGINX_PORT=80 + networks: + apisix: + + prometheus: + image: prom/prometheus:v2.25.0 + restart: always + volumes: + - ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml + ports: + - "9090:9090" + networks: + apisix: + + grafana: + image: grafana/grafana:7.3.7 + restart: always + ports: + - "3000:3000" + volumes: + - "./grafana_conf/provisioning:/etc/grafana/provisioning" + - "./grafana_conf/dashboards:/var/lib/grafana/dashboards" + - "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini" + networks: + apisix: + +networks: + apisix: + driver: bridge + +volumes: + etcd_data: + driver: local diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/pom.xml similarity index 82% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/pom.xml index d19472fca..739741dba 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/pom.xml @@ -23,11 +23,11 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple</artifactId> + <artifactId>dubbo-samples-gateway-apisix</artifactId> <version>1.0-SNAPSHOT</version> </parent> - <artifactId>dubbo-samples-gateway-higress-triple-consumer</artifactId> + <artifactId>dubbo-samples-gateway-apisix-triple</artifactId> <properties> <maven.compiler.source>17</maven.compiler.source> @@ -36,16 +36,14 @@ </properties> <dependencies> + <!-- dubbo --> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple-interface</artifactId> - <version>${project.parent.version}</version> + <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> - - <!-- dubbo --> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-spring-boot-starter</artifactId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> <!-- spring starter --> @@ -65,6 +63,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/DemoService.java similarity index 94% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/DemoService.java index 202775d89..16232bdd7 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/DemoService.java @@ -14,10 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.api; +package org.apache.dubbo.samples.gateway.apisix; public interface DemoService { - String sayHello(String name); - } diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/ProviderApplication.java similarity index 91% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/ProviderApplication.java index 6c6f9e806..fc8955228 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/ProviderApplication.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.apisix; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; @@ -24,7 +24,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @EnableDubbo public class ProviderApplication { + public static void main(String[] args) { SpringApplication.run(ProviderApplication.class, args); + System.out.println("dubbo service started"); } } diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/impl/DemoServiceImpl.java similarity index 88% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/impl/DemoServiceImpl.java index e875f4d0d..014ed10b4 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/java/org/apache/dubbo/samples/gateway/apisix/impl/DemoServiceImpl.java @@ -14,15 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.apisix.impl; import org.apache.dubbo.config.annotation.DubboService; -import org.apache.dubbo.samples.api.DemoService; - +import org.apache.dubbo.samples.gateway.apisix.DemoService; @DubboService public class DemoServiceImpl implements DemoService { + + @Override public String sayHello(String name) { return "Hello " + name; } + } diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/application.yml similarity index 72% copy from 1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/application.yml index 835922e34..6c183ea16 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/application.yml @@ -13,10 +13,17 @@ # 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: 8080 dubbo: - application: - name: dubbo-springboot-demo-consumer - logger: slf4j - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + application: + logger: slf4j + name: gateway-apisix-triple + qos-port: 33333 + registry: + address: nacos://${nacos.address:127.0.0.1}:8848 + username: nacos + password: nacos + protocol: + name: tri + port: 50052 diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/log4j2.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/log4j2.xml new file mode 100644 index 000000000..69e1321d2 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-triple/src/main/resources/log4j2.xml @@ -0,0 +1,29 @@ +<?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. + --> +<Configuration status="WARN"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT" follow="true"> + <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta} %style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue} %style{-|}{White} %m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}" disableAnsi="false" charset="UTF-8"/> + </Console> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml index 310af2a3d..f5136becd 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/pom.xml @@ -1,35 +1,36 @@ +<?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"> - <!-- - ~ - ~ 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. - ~ - --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <artifactId>dubbo-samples-gateway-apisix</artifactId> <packaging>pom</packaging> - <name>Dubbo Samples Gateway Apisix</name> - <description>Dubbo Samples Gateway Apisix</description> + + <artifactId>dubbo-samples-gateway-apisix</artifactId> + <modules> + <module>dubbo-samples-gateway-apisix-triple</module> <module>dubbo-samples-gateway-apisix-dubbo</module> </modules> @@ -37,14 +38,82 @@ <maven.compiler.source>17</maven.compiler.source> <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + + <dubbo.version>3.3.0-beta.2</dubbo.version> + <log4j2.version>2.20.0</log4j2.version> + <junit.version>4.13.1</junit.version> + <spring.version>6.1.5</spring.version> + <spring-boot.version>3.2.3</spring-boot.version> + + <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> </properties> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-framework-bom</artifactId> + <version>${spring.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <artifactId>spring-boot-starter-logging</artifactId> + <groupId>org.springframework.boot</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-bom</artifactId> + <version>${dubbo.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + </dependencies> + </dependencyManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <compilerArgs> + <compilerArg>-proc:none</compilerArg> + </compilerArgs> + </configuration> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + </build> + </project> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/README.md b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/README.md new file mode 100644 index 000000000..7d653567b --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/README.md @@ -0,0 +1 @@ +Please visit [the official website](http://dubbo-next.apache.org/zh-cn/overview/mannual/java-sdk/tasks/gateway/dubbo/) for more details of this example. diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy-interface-registry.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy-interface-registry.yaml new file mode 100644 index 000000000..0d050c92b --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy-interface-registry.yaml @@ -0,0 +1,91 @@ +# 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. + +apiVersion: networking.istio.io/v1alpha3 +kind: EnvoyFilter +metadata: + name: http-dubbo-transcoder-test + namespace: higress-system +spec: + configPatches: + - applyTo: HTTP_FILTER + match: + context: GATEWAY + listener: + filterChain: + filter: + name: envoy.filters.network.http_connection_manager + subFilter: + name: envoy.filters.http.router + patch: + operation: INSERT_BEFORE + value: + name: envoy.filters.http.http_dubbo_transcoder + typed_config: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.filters.http.http_dubbo_transcoder.v3.HttpDubboTranscoder + - applyTo: HTTP_ROUTE + match: + context: GATEWAY + routeConfiguration: + vhost: + route: + name: demo + patch: + operation: MERGE + value: + route: + upgrade_configs: + - connect_config: + allow_post: true + upgrade_type: CONNECT + typed_per_filter_config: + envoy.filters.http.http_dubbo_transcoder: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.filters.http.http_dubbo_transcoder.v3.HttpDubboTranscoder + value: + request_validation_options: + reject_unknown_method: true + reject_unknown_query_parameters: true + services_mapping: + - group: dev + method_mapping: + - name: sayName + parameter_mapping: + - extract_key: p + extract_key_spec: ALL_QUERY_PARAMETER + mapping_type: java.lang.String + passthrough_setting: + passthrough_all_headers: true + path_matcher: + match_http_method_spec: ALL_GET + match_pattern: /dubbo/hello + name: org.apache.dubbo.samples.gateway.api.DemoService + version: 1.0.0 + url_unescape_spec: ALL_CHARACTERS_EXCEPT_RESERVED + - applyTo: CLUSTER + match: + cluster: + service: providers:org.apache.dubbo.samples.gateway.api.DemoService:1.0.0:dev.DEFAULT-GROUP.public.nacos + context: GATEWAY + patch: + operation: MERGE + value: + upstream_config: + name: envoy.upstreams.http.dubbo_tcp + typed_config: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.upstreams.http.dubbo_tcp.v3.DubboTcpConnectionPoolProto diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy.yaml new file mode 100644 index 000000000..d7f8ba879 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/dubbo-proxy/proxy.yaml @@ -0,0 +1,91 @@ +# 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. + +apiVersion: networking.istio.io/v1alpha3 +kind: EnvoyFilter +metadata: + name: http-dubbo-transcoder-test + namespace: higress-system +spec: + configPatches: + - applyTo: HTTP_FILTER + match: + context: GATEWAY + listener: + filterChain: + filter: + name: envoy.filters.network.http_connection_manager + subFilter: + name: envoy.filters.http.router + patch: + operation: INSERT_BEFORE + value: + name: envoy.filters.http.http_dubbo_transcoder + typed_config: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.filters.http.http_dubbo_transcoder.v3.HttpDubboTranscoder + - applyTo: HTTP_ROUTE + match: + context: GATEWAY + routeConfiguration: + vhost: + route: + name: demo + patch: + operation: MERGE + value: + route: + upgrade_configs: + - connect_config: + allow_post: true + upgrade_type: CONNECT + typed_per_filter_config: + envoy.filters.http.http_dubbo_transcoder: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.filters.http.http_dubbo_transcoder.v3.HttpDubboTranscoder + value: + request_validation_options: + reject_unknown_method: true + reject_unknown_query_parameters: true + services_mapping: + - group: dev + method_mapping: + - name: sayName + parameter_mapping: + - extract_key: p + extract_key_spec: ALL_QUERY_PARAMETER + mapping_type: java.lang.String + passthrough_setting: + passthrough_all_headers: true + path_matcher: + match_http_method_spec: ALL_GET + match_pattern: /dubbo/hello + name: org.apache.dubbo.samples.gateway.api.DemoService + version: 1.0.0 + url_unescape_spec: ALL_CHARACTERS_EXCEPT_RESERVED + - applyTo: CLUSTER + match: + cluster: + service: gateway-higress-dubbo.DEFAULT-GROUP.public.nacos + context: GATEWAY + patch: + operation: MERGE + value: + upstream_config: + name: envoy.upstreams.http.dubbo_tcp + typed_config: + '@type': type.googleapis.com/udpa.type.v1.TypedStruct + type_url: type.googleapis.com/envoy.extensions.upstreams.http.dubbo_tcp.v3.DubboTcpConnectionPoolProto diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress-interface-registry.yaml similarity index 82% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress-interface-registry.yaml index 92eb80432..13045b473 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress-interface-registry.yaml @@ -17,10 +17,10 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - annotations: - higress.io/destination: providers:org.apache.dubbo.samples.gateway.api.DemoService::.DEFAULT-GROUP.public.nacos - name: higress-triple-demo - namespace: higress-system + annotations: + higress.io/destination: providers:org.apache.dubbo.samples.gateway.api.DemoService:1.0.0:dev.DEFAULT-GROUP.public.nacos + name: demo + namespace: default spec: ingressClassName: higress rules: @@ -31,5 +31,5 @@ spec: apiGroup: networking.higress.io kind: McpBridge name: default - path: /demo + path: /org.apache.dubbo.samples.gateway.api.DemoService pathType: Prefix diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress.yaml similarity index 64% copy from 1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress.yaml index 4ee1f02b6..a67e156c3 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-provider/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/ingress/Ingress.yaml @@ -14,12 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -dubbo: - application: - name: dubbo-springboot-demo-idl-provider - logger: slf4j - protocol: - name: tri - port: 50052 - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + higress.io/destination: gateway-higress-dubbo.DEFAULT-GROUP.public.nacos + name: demo + namespace: higress-system +spec: + ingressClassName: higress + rules: + - http: + paths: + - backend: + resource: + apiGroup: networking.higress.io + kind: McpBridge + name: default + path: /dubbo + pathType: Prefix diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/mcp/mcpbridge.yml similarity index 69% copy from 1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/mcp/mcpbridge.yml index f0c03c026..dde9fffcd 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/mcp/mcpbridge.yml @@ -14,10 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -dubbo: - application: - name: dubbo-springboot-demo-consumer - logger: slf4j - qos-port: 33333 - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + +apiVersion: networking.higress.io/v1 +kind: McpBridge +metadata: + name: nacos-service-resource + namespace: higress-system +spec: + registries: + - domain: nacos-server.default.svc.cluster.local + nacosGroups: + - DEFAULT_GROUP + name: nacos-service-resource + port: 8848 + type: nacos2 diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/nacos/Nacos.yaml similarity index 51% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/nacos/Nacos.yaml index 1d2f0b216..3b3563f67 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/nacos/Nacos.yaml @@ -14,29 +14,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: apps/v1 kind: Deployment +apiVersion: apps/v1 +metadata: + name: nacos-server +spec: + replicas: 1 + selector: + matchLabels: + app: nacos-server + template: + metadata: + labels: + app: nacos-server + spec: + containers: + - env: + - name: MODE + value: standalone + image: nacos/nacos-server:v2.2.0 + imagePullPolicy: Always + name: nacos-server + ports: + - containerPort: 8848 + name: client + - containerPort: 9848 + name: client-rpc + - containerPort: 9849 + name: raft-rpc + - containerPort: 7848 + name: old-raft-rpc + dnsPolicy: ClusterFirst + restartPolicy: Always + +--- +apiVersion: v1 +kind: Service metadata: - name: gateway-higress-triple-provider - namespace: default - labels: - app: gateway-higress-triple-provider + name: nacos-server spec: - replicas: 1 - selector: - matchLabels: - app: gateway-higress-triple-provider - template: - metadata: - labels: - app: gateway-higress-triple-provider - spec: - containers: - - name: gateway-higress-triple-provider - image: docker.io/allenyi/higress-triple:2.0.0 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 20880 - env: - - name: NACOS_ADDRESS - value: nacos-server.default.svc.cluster.local + ports: + - port: 8848 + name: server + protocol: TCP + targetPort: 8848 + selector: + app: nacos-server + type: ClusterIP \ No newline at end of file diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/provider/Deployment.yaml similarity index 93% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/provider/Deployment.yaml index 1d2f0b216..7931a36e8 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/deploy/provider/Deployment.yaml @@ -29,10 +29,10 @@ spec: template: metadata: labels: - app: gateway-higress-triple-provider + app: gateway-higress-dubbo-provider spec: containers: - - name: gateway-higress-triple-provider + - name: gateway-higress-dubbo-provider image: docker.io/allenyi/higress-triple:2.0.0 imagePullPolicy: IfNotPresent ports: diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/pom.xml similarity index 78% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/pom.xml index d19472fca..ec3f60402 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/pom.xml @@ -23,11 +23,11 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo</artifactId> <version>1.0-SNAPSHOT</version> </parent> - <artifactId>dubbo-samples-gateway-higress-triple-consumer</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo-consumer</artifactId> <properties> <maven.compiler.source>17</maven.compiler.source> @@ -38,7 +38,7 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple-interface</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo-interface</artifactId> <version>${project.parent.version}</version> </dependency> @@ -47,6 +47,10 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> + </dependency> <!-- spring starter --> <dependency> @@ -65,6 +69,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java similarity index 99% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java index 5cac7b9b2..8e8d69e89 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/ConsumerApplication.java @@ -20,7 +20,6 @@ import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; - @SpringBootApplication @EnableDubbo public class ConsumerApplication { diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/task/Task.java similarity index 63% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/task/Task.java index aee203409..ba9d431d0 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/Task.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/java/org/apache/dubbo/samples/gateway/consumer/task/Task.java @@ -14,35 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.consumer; +package org.apache.dubbo.samples.gateway.consumer.task; import org.apache.dubbo.config.annotation.DubboReference; -import org.apache.dubbo.samples.api.DemoService; +import org.apache.dubbo.samples.gateway.api.DemoService; import org.springframework.boot.CommandLineRunner; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; -import java.util.Date; +import org.springframework.web.client.RestClient; @Component public class Task implements CommandLineRunner { - @DubboReference private DemoService demoService; @Override public void run(String... args) throws Exception { - String result = demoService.sayHello("world"); - System.out.println("Receive result ======> " + result); - - new Thread(()-> { - while (true) { - try { - Thread.sleep(1000); - System.out.println(new Date() + " Receive result ======> " + demoService.sayHello("world")); - } catch (InterruptedException e) { - e.printStackTrace(); - Thread.currentThread().interrupt(); - } - } - }).start(); + System.out.println("Receive result ======> " + demoService.sayHello("world")); } + } diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/application.yml similarity index 76% copy from 1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/application.yml index 835922e34..45e1a2d93 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/application.yml @@ -13,10 +13,13 @@ # 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. - dubbo: - application: - name: dubbo-springboot-demo-consumer - logger: slf4j - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + application: + name: gateway-higress-dubbo-consumer + logger: slf4j + registry: + address: nacos://${nacos.address:127.0.0.1}:8848 + username: nacos + password: nacos + consumer: + check: false diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/log4j2.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/log4j2.xml new file mode 100644 index 000000000..69e1321d2 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-consumer/src/main/resources/log4j2.xml @@ -0,0 +1,29 @@ +<?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. + --> +<Configuration status="WARN"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT" follow="true"> + <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta} %style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue} %style{-|}{White} %m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}" disableAnsi="false" charset="UTF-8"/> + </Console> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/pom.xml similarity index 62% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/pom.xml index d19472fca..89cdaee0c 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/pom.xml @@ -23,11 +23,11 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo</artifactId> <version>1.0-SNAPSHOT</version> </parent> - <artifactId>dubbo-samples-gateway-higress-triple-consumer</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo-interface</artifactId> <properties> <maven.compiler.source>17</maven.compiler.source> @@ -36,36 +36,18 @@ </properties> <dependencies> + <!-- spring web annotation support --> <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple-interface</artifactId> - <version>${project.parent.version}</version> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> </dependency> - - <!-- dubbo --> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-spring-boot-starter</artifactId> - </dependency> - - <!-- spring starter --> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter</artifactId> + <groupId>com.alibaba.spring</groupId> + <artifactId>spring-context-support</artifactId> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-log4j2</artifactId> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> </dependency> </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - </plugin> - </plugins> - </build> </project> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java similarity index 94% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java index 202775d89..2a0434bdf 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-interface/src/main/java/org/apache/dubbo/samples/api/DemoService.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java @@ -14,10 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.api; +package org.apache.dubbo.samples.gateway.api; public interface DemoService { - String sayHello(String name); - } diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/Dockerfile similarity index 72% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/Dockerfile index af3290405..9d8b7a8cc 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/Dockerfile @@ -12,16 +12,8 @@ # 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: 8888 -dubbo: - application: - name: dubbo-gateway-provider - protocol: - name: dubbo - port: 20880 - serialization: fastjson2 - registry: - address: nacos://${nacos.address:127.0.0.1}:8848 - username: nacos - password: nacos +FROM openjdk:17-jre +ADD dubbo-samples-gateway-higress-dubbo-provider-1.0-SNAPSHOT.jar /dubbo-samples-gateway-higress-dubbo-provider-1.0-SNAPSHOT.jar +EXPOSE 50052 +CMD java -jar dubbo-samples-gateway-higress-dubbo-provider-1.0-SNAPSHOT.jar + diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/pom.xml similarity index 78% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/pom.xml index d19472fca..43082542a 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/pom.xml @@ -23,11 +23,11 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo</artifactId> <version>1.0-SNAPSHOT</version> </parent> - <artifactId>dubbo-samples-gateway-higress-triple-consumer</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo-provider</artifactId> <properties> <maven.compiler.source>17</maven.compiler.source> @@ -38,7 +38,7 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-samples-gateway-higress-triple-interface</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo-interface</artifactId> <version>${project.parent.version}</version> </dependency> @@ -47,6 +47,10 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> + </dependency> <!-- spring starter --> <dependency> @@ -65,6 +69,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java similarity index 95% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java index 6c6f9e806..3249ce56b 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/ProviderApplication.java @@ -24,7 +24,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @EnableDubbo public class ProviderApplication { + public static void main(String[] args) { SpringApplication.run(ProviderApplication.class, args); + System.out.println("dubbo service started"); } } diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/impl/DemoServiceImpl.java similarity index 88% rename from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java rename to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/impl/DemoServiceImpl.java index e875f4d0d..a4573d011 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-apisix/dubbo-samples-gateway-apisix-dubbo/dubbo-samples-gateway-apisix-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/DemoServiceImpl.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/java/org/apache/dubbo/samples/gateway/provider/impl/DemoServiceImpl.java @@ -14,15 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.samples.gateway.provider; +package org.apache.dubbo.samples.gateway.provider.impl; import org.apache.dubbo.config.annotation.DubboService; -import org.apache.dubbo.samples.api.DemoService; - +import org.apache.dubbo.samples.gateway.api.DemoService; @DubboService public class DemoServiceImpl implements DemoService { + + @Override public String sayHello(String name) { return "Hello " + name; } + } diff --git a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/application.yml similarity index 72% copy from 1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/application.yml index 835922e34..80fba9038 100644 --- a/1-basic/dubbo-samples-spring-boot-idl/dubbo-samples-spring-boot-idl-consumer/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/application.yml @@ -13,10 +13,17 @@ # 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: 8080 dubbo: - application: - name: dubbo-springboot-demo-consumer - logger: slf4j - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + application: + logger: slf4j + name: gateway-higress-dubbo-provider + qos-port: 33333 + registry: + address: nacos://${nacos.address:127.0.0.1}:8848 + username: nacos + password: nacos + protocol: + name: dubbo + port: 20880 diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/log4j2.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/log4j2.xml new file mode 100644 index 000000000..69e1321d2 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/dubbo-samples-gateway-higress-dubbo-provider/src/main/resources/log4j2.xml @@ -0,0 +1,29 @@ +<?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. + --> +<Configuration status="WARN"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT" follow="true"> + <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta} %style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue} %style{-|}{White} %m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}" disableAnsi="false" charset="UTF-8"/> + </Console> + </Appenders> + <Loggers> + <Root level="info"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/pom.xml similarity index 72% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/pom.xml index b81c42de0..88022dc14 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-dubbo/pom.xml @@ -26,12 +26,12 @@ <packaging>pom</packaging> - <artifactId>dubbo-samples-gateway-higress-triple</artifactId> + <artifactId>dubbo-samples-gateway-higress-dubbo</artifactId> <modules> - <module>dubbo-samples-gateway-higress-triple-interface</module> - <module>dubbo-samples-gateway-higress-triple-provider</module> - <module>dubbo-samples-gateway-higress-triple-consumer</module> + <module>dubbo-samples-gateway-higress-dubbo-interface</module> + <module>dubbo-samples-gateway-higress-dubbo-provider</module> + <module>dubbo-samples-gateway-higress-dubbo-consumer</module> </modules> <properties> @@ -39,8 +39,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dubbo.version>3.3.0-beta.2-SNAPSHOT</dubbo.version> - <dubbo-nacos.version>3.3.0-beta.1</dubbo-nacos.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <log4j2.version>2.20.0</log4j2.version> <junit.version>4.13.1</junit.version> <spring.version>6.1.5</spring.version> @@ -88,43 +87,6 @@ </dependencies> </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-registry-nacos</artifactId> - <version>${dubbo-nacos.version}</version> - <exclusions> - <exclusion> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-registry-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-common</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j2.version}</version> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-framework-bom</artifactId> - <version>${spring.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - <build> <plugins> <plugin> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/README.md b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/README.md new file mode 100644 index 000000000..1e0019b48 --- /dev/null +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/README.md @@ -0,0 +1 @@ +Please visit [the official website](http://dubbo-nexe.apache.org/zh-cn/overview/mannual/java-sdk/tasks/gateway/triple/) for more details of this example. diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml index 92eb80432..5bd96c984 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/ingress/Ingress.yaml @@ -17,10 +17,10 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - annotations: - higress.io/destination: providers:org.apache.dubbo.samples.gateway.api.DemoService::.DEFAULT-GROUP.public.nacos - name: higress-triple-demo - namespace: higress-system + annotations: + higress.io/destination: gateway-higress-triple-provider.DEFAULT-GROUP.public.nacos + name: demo + namespace: default spec: ingressClassName: higress rules: @@ -31,5 +31,5 @@ spec: apiGroup: networking.higress.io kind: McpBridge name: default - path: /demo + path: /org.apache.dubbo.samples.gateway.api.DemoService pathType: Prefix diff --git a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/mcp/mcpbridge.yml similarity index 69% copy from 1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/mcp/mcpbridge.yml index f0c03c026..dde9fffcd 100644 --- a/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-consumer/src/main/resources/application.yml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/mcp/mcpbridge.yml @@ -14,10 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -dubbo: - application: - name: dubbo-springboot-demo-consumer - logger: slf4j - qos-port: 33333 - registry: - address: zookeeper://${zookeeper.address:127.0.0.1}:2181 + +apiVersion: networking.higress.io/v1 +kind: McpBridge +metadata: + name: nacos-service-resource + namespace: higress-system +spec: + registries: + - domain: nacos-server.default.svc.cluster.local + nacosGroups: + - DEFAULT_GROUP + name: nacos-service-resource + port: 8848 + type: nacos2 diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/nacos/Nacos.yaml similarity index 51% copy from 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml copy to 2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/nacos/Nacos.yaml index 1d2f0b216..3b3563f67 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/nacos/Nacos.yaml @@ -14,29 +14,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: apps/v1 kind: Deployment +apiVersion: apps/v1 +metadata: + name: nacos-server +spec: + replicas: 1 + selector: + matchLabels: + app: nacos-server + template: + metadata: + labels: + app: nacos-server + spec: + containers: + - env: + - name: MODE + value: standalone + image: nacos/nacos-server:v2.2.0 + imagePullPolicy: Always + name: nacos-server + ports: + - containerPort: 8848 + name: client + - containerPort: 9848 + name: client-rpc + - containerPort: 9849 + name: raft-rpc + - containerPort: 7848 + name: old-raft-rpc + dnsPolicy: ClusterFirst + restartPolicy: Always + +--- +apiVersion: v1 +kind: Service metadata: - name: gateway-higress-triple-provider - namespace: default - labels: - app: gateway-higress-triple-provider + name: nacos-server spec: - replicas: 1 - selector: - matchLabels: - app: gateway-higress-triple-provider - template: - metadata: - labels: - app: gateway-higress-triple-provider - spec: - containers: - - name: gateway-higress-triple-provider - image: docker.io/allenyi/higress-triple:2.0.0 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 20880 - env: - - name: NACOS_ADDRESS - value: nacos-server.default.svc.cluster.local + ports: + - port: 8848 + name: server + protocol: TCP + targetPort: 8848 + selector: + app: nacos-server + type: ClusterIP \ No newline at end of file diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml index 1d2f0b216..ceb08fea1 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/deploy/provider/Deployment.yaml @@ -36,7 +36,7 @@ spec: image: docker.io/allenyi/higress-triple:2.0.0 imagePullPolicy: IfNotPresent ports: - - containerPort: 20880 + - containerPort: 50052 env: - name: NACOS_ADDRESS value: nacos-server.default.svc.cluster.local diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml index d19472fca..9459eec39 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-consumer/pom.xml @@ -47,6 +47,10 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> + </dependency> <!-- spring starter --> <dependency> @@ -65,6 +69,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java index 39ab9352e..082520367 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-interface/src/main/java/org/apache/dubbo/samples/gateway/api/DemoService.java @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -@RequestMapping("/demo") +@RequestMapping("/triple/demo") public interface DemoService { @RequestMapping(method = RequestMethod.GET, value = "/hello") diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-provider/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-provider/pom.xml index dbe131cf2..2607d2988 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-provider/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/dubbo-samples-gateway-higress-triple-provider/pom.xml @@ -47,6 +47,10 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> + </dependency> <!-- spring starter --> <dependency> @@ -65,6 +69,14 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> </plugin> </plugins> </build> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml index b81c42de0..3e282a9fe 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/dubbo-samples-gateway-higress-triple/pom.xml @@ -39,8 +39,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dubbo.version>3.3.0-beta.2-SNAPSHOT</dubbo.version> - <dubbo-nacos.version>3.3.0-beta.1</dubbo-nacos.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <log4j2.version>2.20.0</log4j2.version> <junit.version>4.13.1</junit.version> <spring.version>6.1.5</spring.version> @@ -88,43 +87,6 @@ </dependencies> </dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-registry-nacos</artifactId> - <version>${dubbo-nacos.version}</version> - <exclusions> - <exclusion> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-registry-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-common</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j2.version}</version> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-framework-bom</artifactId> - <version>${spring.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - <build> <plugins> <plugin> diff --git a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/pom.xml b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/pom.xml index 2a5b4191d..b303842f9 100644 --- a/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/pom.xml +++ b/2-advanced/dubbo-samples-gateway/dubbo-samples-gateway-higress/pom.xml @@ -30,6 +30,7 @@ <artifactId>dubbo-samples-gateway-higress</artifactId> <modules> + <module>dubbo-samples-gateway-higress-dubbo</module> <module>dubbo-samples-gateway-higress-triple</module> </modules> diff --git a/2-advanced/dubbo-samples-gateway/pom.xml b/2-advanced/dubbo-samples-gateway/pom.xml index 0ac1c2401..cabbf0757 100644 --- a/2-advanced/dubbo-samples-gateway/pom.xml +++ b/2-advanced/dubbo-samples-gateway/pom.xml @@ -31,8 +31,8 @@ <description>Dubbo Samples Gateway</description> <modules> - <module>dubbo-samples-gateway-apisix</module> <module>dubbo-samples-gateway-higress</module> + <module>dubbo-samples-gateway-apisix</module> </modules> <repositories> diff --git a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/pom.xml b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/pom.xml index 1f44cbe73..d5afa372d 100644 --- a/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/pom.xml +++ b/3-extensions/registry/dubbo-samples-nacos/dubbo-samples-nacos-registry/pom.xml @@ -39,6 +39,7 @@ <junit.version>4.13.1</junit.version> <nacos.version>2.1.2</nacos.version> + <spring-boot.version>3.2.3</spring-boot.version> <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> </properties> @@ -46,13 +47,23 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-framework-bom</artifactId> - <version>${spring.version}</version> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> - + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot.version}</version> + <exclusions> + <exclusion> + <artifactId>spring-boot-starter-logging</artifactId> + <groupId>org.springframework.boot</groupId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-bom</artifactId> @@ -60,76 +71,47 @@ <type>pom</type> <scope>import</scope> </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - </dependency> </dependencies> </dependencyManagement> <dependencies> + + <!-- dubbo --> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> + <artifactId>dubbo-spring-boot-starter</artifactId> </dependency> - <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-configcenter-nacos</artifactId> - <exclusions> - <exclusion> - <groupId>com.alibaba.nacos</groupId> - <artifactId>nacos-client</artifactId> - </exclusion> - </exclusions> + <artifactId>dubbo-nacos-spring-boot-starter</artifactId> </dependency> + <!-- spring starter --> <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo-registry-nacos</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> - <groupId>com.alibaba.nacos</groupId> - <artifactId>nacos-client</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <version>${log4j2.version}</version> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - - <dependency> - <groupId>com.alibaba.nacos</groupId> - <artifactId>nacos-client</artifactId> - <version>${nacos.version}</version> - <exclusions> - <exclusion> - <artifactId>simpleclient</artifactId> - <groupId>io.prometheus</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <artifactId>simpleclient</artifactId> - <groupId>io.prometheus</groupId> - <version>0.16.0</version> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> diff --git a/3-extensions/registry/dubbo-samples-zookeeper/pom.xml b/3-extensions/registry/dubbo-samples-zookeeper/pom.xml index 9110359df..85d7ed9af 100644 --- a/3-extensions/registry/dubbo-samples-zookeeper/pom.xml +++ b/3-extensions/registry/dubbo-samples-zookeeper/pom.xml @@ -33,7 +33,7 @@ <maven.compiler.target>17</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <dubbo.version>3.3.0-beta.1</dubbo.version> + <dubbo.version>3.3.0-beta.2</dubbo.version> <spring-boot.version>3.2.3</spring-boot.version> <junit5.version>5.10.1</junit5.version> --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org