Skip to content

Commit

Permalink
Update Dubbo version to 3.3.1 (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ authored Oct 25, 2024
1 parent 4ed24d4 commit 7bc0b29
Show file tree
Hide file tree
Showing 175 changed files with 287 additions and 1,918 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package org.apache.dubbo.samples.tri.unary;
package org.apache.dubbo.samples.tri.unary;

import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.PathResolver;
import org.apache.dubbo.rpc.RpcException;
Expand All @@ -28,20 +28,19 @@
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.model.StubMethodDescriptor;
import org.apache.dubbo.rpc.model.StubServiceDescriptor;
import org.apache.dubbo.rpc.stub.BiStreamMethodHandler;
import org.apache.dubbo.rpc.stub.ServerStreamMethodHandler;
import org.apache.dubbo.rpc.service.Destroyable;
import org.apache.dubbo.rpc.stub.StubInvocationUtil;
import org.apache.dubbo.rpc.stub.StubInvoker;
import org.apache.dubbo.rpc.stub.StubMethodHandler;
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.stub.UnaryStubMethodHandler;

import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

import com.google.protobuf.Message;

public final class DubboGreeterTriple {

Expand All @@ -63,31 +62,40 @@ public static Greeter newStub(Invoker<?> invoker) {
}

private static final StubMethodDescriptor greetMethod = new StubMethodDescriptor("greet",
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, org.apache.dubbo.samples.tri.unary.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, org.apache.dubbo.samples.tri.unary.GreeterReply.class, MethodDescriptor.RpcType.UNARY,
obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.samples.tri.unary.GreeterRequest::parseFrom,
org.apache.dubbo.samples.tri.unary.GreeterReply::parseFrom);

private static final StubMethodDescriptor greetAsyncMethod = new StubMethodDescriptor("greet",
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, java.util.concurrent.CompletableFuture.class, MethodDescriptor.RpcType.UNARY,
obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.samples.tri.unary.GreeterRequest::parseFrom,
org.apache.dubbo.samples.tri.unary.GreeterReply::parseFrom);

private static final StubMethodDescriptor greetProxyAsyncMethod = new StubMethodDescriptor("greetAsync",
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, org.apache.dubbo.samples.tri.unary.GreeterReply.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
org.apache.dubbo.samples.tri.unary.GreeterRequest.class, org.apache.dubbo.samples.tri.unary.GreeterReply.class, MethodDescriptor.RpcType.UNARY,
obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), org.apache.dubbo.samples.tri.unary.GreeterRequest::parseFrom,
org.apache.dubbo.samples.tri.unary.GreeterReply::parseFrom);




static{
serviceDescriptor.addMethod(greetMethod);
serviceDescriptor.addMethod(greetProxyAsyncMethod);
}

public static class GreeterStub implements Greeter{
public static class GreeterStub implements Greeter, Destroyable {
private final Invoker<Greeter> invoker;

public GreeterStub(Invoker<Greeter> invoker) {
this.invoker = invoker;
}

@Override
public void $destroy() {
invoker.destroy();
}

@Override
public org.apache.dubbo.samples.tri.unary.GreeterReply greet(org.apache.dubbo.samples.tri.unary.GreeterRequest request){
return StubInvocationUtil.unaryCall(invoker, greetMethod, request);
Expand All @@ -97,7 +105,6 @@ public CompletableFuture<org.apache.dubbo.samples.tri.unary.GreeterReply> greetA
return StubInvocationUtil.unaryCall(invoker, greetAsyncMethod, request);
}

@Override
public void greet(org.apache.dubbo.samples.tri.unary.GreeterRequest request, StreamObserver<org.apache.dubbo.samples.tri.unary.GreeterReply> responseObserver){
StubInvocationUtil.unaryCall(invoker, greetMethod , request, responseObserver);
}
Expand All @@ -123,15 +130,39 @@ public void accept(T t, StreamObserver<R> observer) {
};
}

@Override
public CompletableFuture<org.apache.dubbo.samples.tri.unary.GreeterReply> greetAsync(org.apache.dubbo.samples.tri.unary.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.samples.tri.unary.GreeterRequest request, StreamObserver<org.apache.dubbo.samples.tri.unary.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()
.getExtensionLoader(PathResolver.class)
.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.samples.tri.unary.GreeterRequest, StreamObserver<org.apache.dubbo.samples.tri.unary.GreeterReply>> greetFunc = this::greet;
handlers.put(greetMethod.getMethodName(), new UnaryStubMethodHandler<>(greetFunc));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,19 @@
* limitations under the License.
*/

package org.apache.dubbo.samples.tri.unary;
package org.apache.dubbo.samples.tri.unary;

import org.apache.dubbo.common.stream.StreamObserver;
import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;

public interface Greeter extends org.apache.dubbo.rpc.model.DubboStub {

String JAVA_SERVICE_NAME = "org.apache.dubbo.samples.tri.unary.Greeter";
String SERVICE_NAME = "org.apache.dubbo.samples.tri.unary.Greeter";

org.apache.dubbo.samples.tri.unary.GreeterReply greet(org.apache.dubbo.samples.tri.unary.GreeterRequest request);

default CompletableFuture<org.apache.dubbo.samples.tri.unary.GreeterReply> greetAsync(org.apache.dubbo.samples.tri.unary.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.samples.tri.unary.GreeterRequest request, StreamObserver<org.apache.dubbo.samples.tri.unary.GreeterReply> responseObserver){
greetAsync(request).whenComplete((r, t) -> {
if (t != null) {
responseObserver.onError(t);
} else {
responseObserver.onNext(r);
responseObserver.onCompleted();
}
});
}
CompletableFuture<org.apache.dubbo.samples.tri.unary.GreeterReply> greetAsync(org.apache.dubbo.samples.tri.unary.GreeterRequest request);





Expand Down
2 changes: 1 addition & 1 deletion 1-basic/dubbo-samples-api-idl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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.1</dubbo.version>
<protobuf-java.version>3.19.6</protobuf-java.version>
<protoc.version>3.22.3</protoc.version>
<log4j2.version>2.20.0</log4j2.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

package org.apache.dubbo.samples.tri.unary;

import java.util.concurrent.CompletableFuture;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.CompletableFuture;

public class GreeterImpl extends DubboGreeterTriple.GreeterImplBase {
private static final Logger LOGGER = LoggerFactory.getLogger(GreeterImpl.class);
private final String serverName;
Expand Down
2 changes: 1 addition & 1 deletion 1-basic/dubbo-samples-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.1</dubbo.version>
<log4j2.version>2.20.0</log4j2.version>
<junit5.version>5.9.2</junit5.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.dubbo.springboot.demo.idl;

import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.PathResolver;
import org.apache.dubbo.rpc.RpcException;
Expand All @@ -28,20 +28,19 @@
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.model.StubMethodDescriptor;
import org.apache.dubbo.rpc.model.StubServiceDescriptor;
import org.apache.dubbo.rpc.stub.BiStreamMethodHandler;
import org.apache.dubbo.rpc.stub.ServerStreamMethodHandler;
import org.apache.dubbo.rpc.service.Destroyable;
import org.apache.dubbo.rpc.stub.StubInvocationUtil;
import org.apache.dubbo.rpc.stub.StubInvoker;
import org.apache.dubbo.rpc.stub.StubMethodHandler;
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.stub.UnaryStubMethodHandler;

import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

import com.google.protobuf.Message;

public final class DubboGreeterTriple {

Expand Down Expand Up @@ -85,13 +84,18 @@ public static Greeter newStub(Invoker<?> invoker) {
serviceDescriptor.addMethod(greetProxyAsyncMethod);
}

public static class GreeterStub implements Greeter{
public static class GreeterStub implements Greeter, Destroyable {
private final Invoker<Greeter> invoker;

public GreeterStub(Invoker<Greeter> invoker) {
this.invoker = invoker;
}

@Override
public void $destroy() {
invoker.destroy();
}

@Override
public org.apache.dubbo.springboot.demo.idl.GreeterReply greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){
return StubInvocationUtil.unaryCall(invoker, greetMethod, request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.dubbo.springboot.demo.idl;

import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.PathResolver;
import org.apache.dubbo.rpc.RpcException;
Expand All @@ -28,20 +28,19 @@
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.model.StubMethodDescriptor;
import org.apache.dubbo.rpc.model.StubServiceDescriptor;
import org.apache.dubbo.rpc.stub.BiStreamMethodHandler;
import org.apache.dubbo.rpc.stub.ServerStreamMethodHandler;
import org.apache.dubbo.rpc.service.Destroyable;
import org.apache.dubbo.rpc.stub.StubInvocationUtil;
import org.apache.dubbo.rpc.stub.StubInvoker;
import org.apache.dubbo.rpc.stub.StubMethodHandler;
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.stub.UnaryStubMethodHandler;

import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

import com.google.protobuf.Message;

public final class DubboGreeterTriple {

Expand Down Expand Up @@ -85,13 +84,18 @@ public static Greeter newStub(Invoker<?> invoker) {
serviceDescriptor.addMethod(greetProxyAsyncMethod);
}

public static class GreeterStub implements Greeter{
public static class GreeterStub implements Greeter, Destroyable {
private final Invoker<Greeter> invoker;

public GreeterStub(Invoker<Greeter> invoker) {
this.invoker = invoker;
}

@Override
public void $destroy() {
invoker.destroy();
}

@Override
public org.apache.dubbo.springboot.demo.idl.GreeterReply greet(org.apache.dubbo.springboot.demo.idl.GreeterRequest request){
return StubInvocationUtil.unaryCall(invoker, greetMethod, request);
Expand Down
2 changes: 1 addition & 1 deletion 1-basic/dubbo-samples-spring-boot-idl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2</dubbo.version>
<dubbo.version>3.3.1</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>
Expand Down
2 changes: 1 addition & 1 deletion 1-basic/dubbo-samples-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2</dubbo.version>
<dubbo.version>3.3.1</dubbo.version>
<spring-boot.version>3.2.3</spring-boot.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
<type>pom</type>
<exclusions>
<exclusion>
Expand Down
2 changes: 1 addition & 1 deletion 10-task/dubbo-samples-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<description>Dubbo Samples benchmark</description>

<properties>
<dubbo.version>3.3.0-beta.1</dubbo.version>
<dubbo.version>3.3.1</dubbo.version>
<junit.version>4.13.1</junit.version>
<spring-boot.version>2.7.8</spring-boot.version>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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.1</dubbo.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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.1</dubbo.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<dubbo.version>3.2.6</dubbo.version>
<dubbo.version>3.3.1</dubbo.version>
<nacos.version>2.2.0</nacos.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<dubbo.version>3.2.6</dubbo.version>
<dubbo.version>3.3.1</dubbo.version>
<nacos.version>2.2.0</nacos.version>
</properties>

Expand Down
Loading

0 comments on commit 7bc0b29

Please sign in to comment.