Skip to content

Commit

Permalink
fix #327
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiaojiee committed Mar 17, 2019
1 parent fe9a71d commit fd5843c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions blog/en-us/dubbo-new-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: This article recalls how asynchronous call is implemented in Dubbo

# How to implement a fully asynchronous calls chain based on Dubbo

Implementing the full asynchronous programming based on Dubbo, which is a new feature introduced in version 2.7.0 after the enhancement of the existing asynchronous mode.This article first reviews the supported functions and existing problems of asynchronization in 2.6.x and earlier versions, and introduces the targeted enhancements based on CompletableFuture in version 2.7.0. Then, the use of enhanced asynchronous programming is elaborated through several examples. Finally, it summarizes the new problems brought by the introduction of asynchronous mode and corresponding solutions from Dubbo.By reading this article, it is easy to implement a fully asynchronous remote service call chain based on Dubbo 2.7.0+.
Implementing the full asynchronous programming based on Dubbo, which is a new feature introduced in version 2.7.0 after the enhancement of the existing asynchronous mode.This article first reviews the supported functions and existing problems of asynchronization in 2.6.x and earlier versions, and introduces the targeted enhancements based on CompletableFuture in version 2.7.0. Then, the use of enhanced asynchronous programming is elaborated through several examples. Finally, it summarizes the new problems brought by the introduction of asynchronous mode and corresponding solutions from Dubbo. By reading this article, it is easy to implement a fully asynchronous remote service call chain based on Dubbo 2.7.0+.

## Asynchronous mode before version 2.6.x

Expand Down Expand Up @@ -162,7 +162,8 @@ Next, let's illustrate how to implement a fully asynchronous Dubbo service call

## example 1:CompletableFuture interface

CompletableFuture interface can be used both for a synchronous call and for an asynchronous call on Consumer or Provider side. This example implements asynchronous calls between Consumer and Provider sides. Code link [dubbo-samples-async-original-future](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-async-original-future).
CompletableFuture interface can be used both for a synchronous call and for an asynchronous call on Consumer or Provider side. This example implements asynchronous calls between Consumer and Provider sides. Code link [dubbo-samples-async-original-future](https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-async/dubbo-samples-async-original-future
).

1. Interface definition

Expand Down Expand Up @@ -265,7 +266,7 @@ CompletableFuture interface can be used both for a synchronous call and for an a
## Example 2:Synchronous interface uses Annotation Processor
This example demonstrates how to implement the Consumer-side asynchronous service call using the Annotation Processor based on the original synchronous interface. Code link [dubbo-samples-async-generated-future](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-async-generated-future).
This example demonstrates how to implement the Consumer-side asynchronous service call using the Annotation Processor based on the original synchronous interface. Code link [dubbo-samples-async-generated-future](https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-async/dubbo-samples-async-generated-future).
1. Interface definition
Expand Down Expand Up @@ -398,7 +399,7 @@ This example demonstrates how to implement the Consumer-side asynchronous servic
## Example 3:Use AsyncContext
This example demonstrates how to implement the Provider-side asynchronous execution through AsyncContext based on the original synchronous interface. Code link [dubbo-samples-async-provider](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-async-provider).
This example demonstrates how to implement the Provider-side asynchronous execution through AsyncContext based on the original synchronous interface. Code link [dubbo-samples-async-provider](https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-async/dubbo-samples-async-provider).
1. Interface definition
Expand Down
6 changes: 3 additions & 3 deletions blog/zh-cn/dubbo-new-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ CompletableFuture类型的接口既可以用作同步调用,也可以实现Con
## 示例2:同步接口使用Annotation Processor
这个示例演示了如何在只定义同步接口的基础上,使用Annotation Processor实现Consumer端异步方服务调用,具体代码参见地址[dubbo-samples-async-generated-future](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-async-generated-future)
这个示例演示了如何在只定义同步接口的基础上,使用Annotation Processor实现Consumer端异步方服务调用,具体代码参见地址[dubbo-samples-async-generated-future](https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-async/dubbo-samples-async-generated-future)
1. 定义接口
Expand Down Expand Up @@ -398,7 +398,7 @@ CompletableFuture类型的接口既可以用作同步调用,也可以实现Con
## 示例3:使用AsyncContext
本示例演示了如何在同步接口的基础上,通过AsyncContext实现Provider端异步执行,示例代码参见[dubbo-samples-async-provider](https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-async-provider)。
本示例演示了如何在同步接口的基础上,通过AsyncContext实现Provider端异步执行,示例代码参见[dubbo-samples-async-provider](https://github.com/apache/incubator-dubbo-samples/tree/master/dubbo-samples-async/dubbo-samples-async-provider)。
1. 定义接口
Expand Down Expand Up @@ -475,7 +475,7 @@ CompletableFuture类型的接口既可以用作同步调用,也可以实现Con
```
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/async-consumer.xml"});
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/async-``consumer.xml"});
context.start();

AsyncService asyncService = (AsyncService) context.getBean("asyncService");
Expand Down

0 comments on commit fd5843c

Please sign in to comment.