Skip to content

Commit

Permalink
Merge branch '3.3' into 3.3-metadata-expire
Browse files Browse the repository at this point in the history
  • Loading branch information
finefuture authored Jan 6, 2025
2 parents f06d49e + 82274d9 commit a6be0e7
Show file tree
Hide file tree
Showing 22 changed files with 90 additions and 56 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Percentage of issues still open](http://isitmaintained.com/badge/open/apache/dubbo.svg)](http://isitmaintained.com/project/apache/dubbo "Percentage of issues still open")

Apache Dubbo is an easy-to-use Web and RPC framework that provides multiple
language implementations(Java, [Go](https://github.com/apache/dubbo-go), [Rust](https://github.com/apache/dubbo-rust), [Node.js](https://github.com/apache/dubbo-js), [Web](https://github.com/apache/dubbo-js)) for communication, service discovery, traffic management,
language implementations(Java, [Go](https://github.com/apache/dubbo-go), [Python](https://github.com/dubbo/py-client-for-apache-dubbo), [PHP](https://github.com/apache/dubbo-php-framework), [Erlang](https://github.com/apache/dubbo-erlang), [Rust](https://github.com/apache/dubbo-rust), [Node.js](https://github.com/apache/dubbo-js), [Web](https://github.com/apache/dubbo-js)) for communication, service discovery, traffic management,
observability, security, tools, and best practices for building enterprise-ready microservices.

We are now collecting Dubbo user info to help us to improve Dubbo further. Kindly support us by providing your usage information on [Wanted: who's using dubbo](https://github.com/apache/dubbo/discussions/13842), thanks :)
Expand All @@ -24,13 +24,13 @@ We are now collecting Dubbo user info to help us to improve Dubbo further. Kindl
Follow the instructions below to learn how to:

### Programming with lightweight RPC API
[5 minutes step-by-step guide](https://dubbo.apache.org/zh-cn/overview/quickstart/rpc/java)
[5 minutes step-by-step guide](https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/tasks/develop/api/)

Dubbo supports building RPC services with only a few lines of code while depending only on a lightweight SDK (<10MB). The protocol on the wire can be [Triple](https://dubbo.apache.org/zh-cn/overview/reference/protocols/triple/)(fully gRPC compatible and HTTP-friendly), Dubbo2(TCP), REST, or any protocol of your choice.


### Building a microservice application with Spring Boot
[5 minutes step-by-step guide](https://dubbo.apache.org/zh-cn/overview/quickstart/microservice)
[5 minutes step-by-step guide](https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/tasks/develop/springboot/)

It's highly recommended to start your microservice application with the Spring Boot Starter `dubbo-spring-boot-starter` provided by Dubbo. With only a single dependency and yaml file, and optionally a bunch of other useful spring boot starters, you can enable all of the Dubo features like service discovery, observability, tracing, etc.

Expand All @@ -50,11 +50,11 @@ Get more details by visiting the links below to get your hands dirty with some w
* [Kubernetes and Service mesh](https://dubbo.apache.org/zh-cn/overview/core-features/service-mesh/)

## Which Dubbo version should I use?
| **Dubbo3** | **JDK** | **Dependencies** | **Description** |
| --- | --- | --- | --- |
| 3.3.0-beta| 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/3.3/dubbo-dependencies-bom/pom.xml#L94) | **- Unstable version** <br/> **- Features** <br/> &nbsp;&nbsp; - Triple - gRPC and cURL compatible.<br/> &nbsp;&nbsp; - Rest-style programming support.<br/> &nbsp;&nbsp; - Spring Boot Starters. |
| 3.2.5 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.5/dubbo-dependencies-bom/pom.xml#L94) | **- Stable version (active)** <br/> **- Features** <br/> &nbsp;&nbsp;- Out-of-box metrics and tracing support.<br/> &nbsp;&nbsp;- Threadpool Isolation<br/> &nbsp;&nbsp;- 30% performance<br/> &nbsp;&nbsp;- Native Image|
| 3.1.11 | 1.8 ~ 11 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.11/dubbo-dependencies-bom/pom.xml#L94) | **Stable version (not active)** |
| **Dubbo3** | **JDK** | **Dependencies** | **Description** |
|------------|----------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 3.3.2 | 1.8 ~ 21 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.3.2/dubbo-dependencies-bom/pom.xml#L92) | **- Stable version (active)** <br/> **- Features** <br/> &nbsp;&nbsp; - Triple - gRPC and cURL compatible.<br/> &nbsp;&nbsp; - Rest-style programming support.<br/> &nbsp;&nbsp; - Spring Boot Starters. |
| 3.2.16 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.5/dubbo-dependencies-bom/pom.xml#L94) | **- Stable version (active)** <br/> **- Features** <br/> &nbsp;&nbsp;- Out-of-box metrics and tracing support.<br/> &nbsp;&nbsp;- Threadpool Isolation<br/> &nbsp;&nbsp;- 30% performance<br/> &nbsp;&nbsp;- Native Image |
| 3.1.11 | 1.8 ~ 17 | [dependency list](https://github.com/apache/dubbo/blob/dubbo-3.2.11/dubbo-dependencies-bom/pom.xml#L90) | **Stable version (not active)** |

| **Dubbo2** | **JDK** | **Dependencies** | **Description** |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -131,7 +131,7 @@ Please report security vulnerabilities to [us](mailto:security@dubbo.apache.org)

## Contributing

See [CONTRIBUTING](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
See [CONTRIBUTING](https://github.com/apache/dubbo/blob/3.3/CONTRIBUTING.md) for details on submitting patches and the contribution workflow.

### How can I contribute?

Expand Down Expand Up @@ -175,4 +175,4 @@ Please report security vulnerabilities to [us](mailto:security@dubbo.apache.org)
* [Erlang](https://github.com/apache/dubbo-erlang)

## License
Apache Dubbo is licensed under the Apache License Version 2.0. See the [LICENSE](https://github.com/apache/dubbo/blob/master/LICENSE) file for details.
Apache Dubbo is licensed under the Apache License Version 2.0. See the [LICENSE](https://github.com/apache/dubbo/blob/3.3/LICENSE) file for details.
2 changes: 1 addition & 1 deletion dubbo-cluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<description>The cluster module of dubbo project</description>
<properties>
<skip_maven_deploy>false</skip_maven_deploy>
<nashorn-core.version>15.4</nashorn-core.version>
<nashorn-core.version>15.6</nashorn-core.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void testSelectByWeight() {
@Test
void testNodeCacheShouldNotRecycle() {
int loop = 10000;
// tmperately add a new invoker
// temperately add a new invoker
weightInvokers.add(weightInvokerTmp);
try {
Map<Invoker, InvokeResult> resultMap = getWeightedInvokeResult(loop, RoundRobinLoadBalance.NAME);
Expand Down Expand Up @@ -143,7 +143,7 @@ void testNodeCacheShouldRecycle() {
}

int loop = 10000;
// tmperately add a new invoker
// temperately add a new invoker
weightInvokers.add(weightInvokerTmp);
try {
Map<Invoker, InvokeResult> resultMap = getWeightedInvokeResult(loop, RoundRobinLoadBalance.NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public interface MethodDescriptor {

Object getAttribute(String key);

Class<?>[] getActualRequestTypes();

Class<?> getActualResponseType();

enum RpcType {
UNARY,
CLIENT_STREAM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@ private RpcType determineRpcType() {
boolean returnIsVoid = returnClass.getName().equals(void.class.getName());
if (returnIsVoid && parameterClasses.length == 1 && isStreamType(parameterClasses[0])) {
actualRequestTypes = Collections.emptyList().toArray(new Class<?>[0]);
actualResponseType = obtainActualTypeInStreamObserver(
((ParameterizedType) method.getGenericParameterTypes()[0]).getActualTypeArguments()[0]);
return RpcType.SERVER_STREAM;
}
if (returnIsVoid
&& parameterClasses.length == 2
&& !isStreamType(parameterClasses[0])
&& isStreamType(parameterClasses[1])) {
actualRequestTypes = parameterClasses;
actualResponseType = obtainActualTypeInStreamObserver(
((ParameterizedType) method.getGenericParameterTypes()[1]).getActualTypeArguments()[0]);
return RpcType.SERVER_STREAM;
}
if (Arrays.stream(parameterClasses).anyMatch(this::isStreamType) || isStreamType(returnClass)) {
Expand All @@ -119,13 +124,6 @@ private boolean isStreamType(Class<?> classType) {
return StreamObserver.class.isAssignableFrom(classType);
}

private static Class<?> obtainActualTypeInStreamObserver(Type typeInStreamObserver) {
return (Class<?>)
(typeInStreamObserver instanceof ParameterizedType
? ((ParameterizedType) typeInStreamObserver).getRawType()
: typeInStreamObserver);
}

@Override
public String getMethodName() {
return methodName;
Expand Down Expand Up @@ -179,14 +177,23 @@ public Object getAttribute(String key) {
return this.attributeMap.get(key);
}

@Override
public Class<?>[] getActualRequestTypes() {
return actualRequestTypes;
}

@Override
public Class<?> getActualResponseType() {
return actualResponseType;
}

private Class<?> obtainActualTypeInStreamObserver(Type typeInStreamObserver) {
return (Class<?>)
(typeInStreamObserver instanceof ParameterizedType
? ((ParameterizedType) typeInStreamObserver).getRawType()
: typeInStreamObserver);
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ public Object getAttribute(String key) {
return this.attributeMap.get(key);
}

@Override
public Class<?>[] getActualRequestTypes() {
return this.parameterClasses;
}

@Override
public Class<?> getActualResponseType() {
return this.returnClass;
}

@Override
public Pack getRequestPack() {
return requestPack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -74,6 +76,7 @@ void testObjectInput() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS) // Charset maynot UTF-8 on Windows JDK 8 ~ 17
void testWriteUTF() throws IOException {
myObjectOutput.writeUTF("Pace");
myObjectOutput.writeUTF("和平");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ private void postProcessConfig() {

/**
* Return if ReferenceConfig has been initialized
* Note: Cannot use `isInitilized` as it may be treated as a Java Bean property
* Note: Cannot use `isInitialized` as it may be treated as a Java Bean property
*
* @return initialized
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public abstract class AbstractInterfaceBuilder<
protected MonitorConfig monitor;

/**
* Strategies for generating dynamic agents,there are two strategies can be choosed: jdk and javassist
* Strategies for generating dynamic agents,there are two strategies can be chosen: jdk and javassist
*/
protected String proxy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

/**
* The test-case for https://github.com/apache/dubbo/issues/6000
* Autowired a ReferenceBean failed in some situation in Spring enviroment
* Autowired a ReferenceBean failed in some situation in Spring environment
*/
@Configuration
@EnableDubbo
Expand Down
2 changes: 1 addition & 1 deletion dubbo-demo/dubbo-demo-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<skip_maven_deploy>true</skip_maven_deploy>
<spring-boot.version>2.7.18</spring-boot.version>
<spring-boot-maven-plugin.version>2.7.18</spring-boot-maven-plugin.version>
<micrometer-core.version>1.14.1</micrometer-core.version>
<micrometer-core.version>1.14.2</micrometer-core.version>
</properties>

<dependencyManagement>
Expand Down
10 changes: 5 additions & 5 deletions dubbo-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<spring_boot_version>2.7.18</spring_boot_version>
<spring_security_version>5.8.16</spring_security_version>
<javassist_version>3.30.2-GA</javassist_version>
<byte-buddy_version>1.15.10</byte-buddy_version>
<byte-buddy_version>1.15.11</byte-buddy_version>
<netty_version>3.2.10.Final</netty_version>
<netty4_version>4.1.115.Final</netty4_version>
<netty_http3_version>0.0.28.Final</netty_http3_version>
Expand Down Expand Up @@ -125,11 +125,11 @@
<micrometer.version>1.13.6</micrometer.version>
<opentelemetry.version>1.45.0</opentelemetry.version>
<zipkin-reporter.version>3.4.3</zipkin-reporter.version>
<micrometer-tracing.version>1.4.0</micrometer-tracing.version>
<micrometer-tracing.version>1.4.1</micrometer-tracing.version>
<t_digest.version>3.3</t_digest.version>
<prometheus_client.version>0.16.0</prometheus_client.version>
<reactive.version>1.0.4</reactive.version>
<reactor.version>3.7.0</reactor.version>
<reactor.version>3.7.1</reactor.version>
<rxjava.version>2.2.21</rxjava.version>
<okhttp_version>3.14.9</okhttp_version>

Expand All @@ -140,7 +140,7 @@
<nacos_version>2.4.3</nacos_version>
<sentinel.version>1.8.8</sentinel.version>
<seata.version>1.8.0</seata.version>
<grpc.version>1.68.2</grpc.version>
<grpc.version>1.69.0</grpc.version>
<grpc_contrib_verdion>0.8.1</grpc_contrib_verdion>
<jprotoc_version>1.2.2</jprotoc_version>
<mustache_version>0.9.14</mustache_version>
Expand All @@ -150,7 +150,7 @@
<log4j_version>1.2.17</log4j_version>
<logback_version>1.2.13</logback_version>
<!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
<log4j2_version>2.24.2</log4j2_version>
<log4j2_version>2.24.3</log4j2_version>
<commons_io_version>2.18.0</commons_io_version>
<commons-codec_version>1.17.1</commons-codec_version>
<groovy_version>4.0.24</groovy_version>
Expand Down
2 changes: 1 addition & 1 deletion dubbo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
<version>3.6.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion dubbo-plugin/dubbo-rest-jaxrs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-rest</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions dubbo-plugin/dubbo-rest-openapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<artifactId>dubbo-rest-openapi</artifactId>

<properties>
<swagger-annotations.version>2.2.25</swagger-annotations.version>
<swagger-annotations.version>2.2.27</swagger-annotations.version>
<swagger-ui.version>5.18.2</swagger-ui.version>
<redoc.version>2.2.0</redoc.version>
<webjars-locator.version>1.0.0</webjars-locator.version>
<webjars-locator.version>1.0.1</webjars-locator.version>
<therapi.version>0.15.0</therapi.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion dubbo-plugin/dubbo-rest-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-rest</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -75,7 +76,7 @@ protected byte[] join(byte[] in1, byte[] in2) {
protected byte[] objectToByte(Object obj) {
byte[] bytes;
if (obj instanceof String) {
bytes = ((String) obj).getBytes();
bytes = ((String) obj).getBytes(StandardCharsets.UTF_8);
} else if (obj instanceof byte[]) {
bytes = (byte[]) obj;
} else {
Expand Down Expand Up @@ -246,7 +247,7 @@ void testDecode_Backspace() throws IOException {
testDecode_assertEquals(new byte[] {'\b'}, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[] {32, 8}));

// test chinese
byte[] chineseBytes = "中".getBytes();
byte[] chineseBytes = "中".getBytes(StandardCharsets.UTF_8);
byte[] request = join(chineseBytes, new byte[] {'\b'});
testDecode_assertEquals(request, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[] {32, 32, 8, 8}));
// There may be some problem handling chinese (negative number recognition). Ignoring this problem, the
Expand Down
6 changes: 6 additions & 0 deletions dubbo-rpc/dubbo-rpc-triple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
<artifactId>spock-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-compiler</artifactId>
<version>${project.parent.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,9 @@ public ReflectionPackableMethod(
switch (method.getRpcType()) {
case CLIENT_STREAM:
case BI_STREAM:
actualRequestTypes = new Class<?>[] {
obtainActualTypeInStreamObserver(
((ParameterizedType) method.getMethod().getGenericReturnType()).getActualTypeArguments()[0])
};
actualResponseType = obtainActualTypeInStreamObserver(
((ParameterizedType) method.getMethod().getGenericParameterTypes()[0])
.getActualTypeArguments()[0]);
break;
case SERVER_STREAM:
actualRequestTypes = method.getMethod().getParameterTypes();
actualResponseType = obtainActualTypeInStreamObserver(
((ParameterizedType) method.getMethod().getGenericParameterTypes()[1])
.getActualTypeArguments()[0]);
actualRequestTypes = method.getActualRequestTypes();
actualResponseType = method.getActualResponseType();
break;
case UNARY:
actualRequestTypes = method.getParameterClasses();
Expand Down Expand Up @@ -411,6 +401,9 @@ public byte[] pack(Object obj) throws IOException {
for (String type : argumentsType) {
builder.addArgTypes(type);
}
if (actualRequestTypes == null || actualRequestTypes.length == 0) {
return builder.build().toByteArray();
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for (int i = 0; i < arguments.length; i++) {
Object argument = arguments[i];
Expand Down
Loading

0 comments on commit a6be0e7

Please sign in to comment.