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 68d7374  embedded async sample
68d7374 is described below

commit 68d7374c414b47ccfa527536d39abd17b786d9c5
Author: ken.lj <[email protected]>
AuthorDate: Sun Jan 30 10:20:38 2022 +0800

    embedded async sample
---
 .../org/apache/dubbo/samples/async/impl/AsyncServiceImpl.java     | 8 ++++++--
 .../test/java/org/apache/dubo/sample/async/AsyncServiceIT.java    | 2 +-
 .../dubbo-samples-async-simple/case-configuration.yml             | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/async/impl/AsyncServiceImpl.java
 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/async/impl/AsyncServiceImpl.java
index 85425a3..ea6c50a 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/async/impl/AsyncServiceImpl.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/async/impl/AsyncServiceImpl.java
@@ -42,14 +42,18 @@ public class AsyncServiceImpl implements AsyncService {
             logger.info("Attachment from consumer: " + 
RpcContext.getContext().getAttachment("consumer-key1"));
             logger.info("async start");
             String embeddedCallResult = null;
+            if (!name.endsWith("IT")) {
+                embeddedCallResult = embeddedService.sayHello("embedded call");
+            }
             try {
                 Thread.sleep(5000);
-                embeddedCallResult = embeddedService.sayHello("embedded call");
                 logger.info("  embedded call result is " + embeddedCallResult);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
-            asyncContext.write("Hello " + name + ", " + embeddedCallResult + " 
response from provider.");
+            asyncContext.write("Hello " + name + ", "
+                    + (embeddedCallResult == null ? "" : embeddedCallResult + 
" ")
+                    + "response from provider.");
             logger.info("async end");
         }).start();
 
diff --git 
a/dubbo-samples-async/dubbo-samples-async-provider/src/test/java/org/apache/dubo/sample/async/AsyncServiceIT.java
 
b/dubbo-samples-async/dubbo-samples-async-provider/src/test/java/org/apache/dubo/sample/async/AsyncServiceIT.java
index a42ec53..f958bc2 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-provider/src/test/java/org/apache/dubo/sample/async/AsyncServiceIT.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-provider/src/test/java/org/apache/dubo/sample/async/AsyncServiceIT.java
@@ -34,6 +34,6 @@ public class AsyncServiceIT {
 
     @Test
     public void test() throws Exception {
-        Assert.assertEquals("Hello dubbo, embedded service response from 
provider.", asyncService.sayHello("dubbo"));
+        Assert.assertEquals("Hello dubbo IT, response from provider.", 
asyncService.sayHello("dubbo IT"));
     }
 }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-simple/case-configuration.yml 
b/dubbo-samples-async/dubbo-samples-async-simple/case-configuration.yml
index 14b9858..df96773 100644
--- a/dubbo-samples-async/dubbo-samples-async-simple/case-configuration.yml
+++ b/dubbo-samples-async/dubbo-samples-async-simple/case-configuration.yml
@@ -17,7 +17,7 @@
 from: app-builtin-zookeeper.yml
 
 props:
-  project_name: dubbo-samples-async-simple
+  project_name: dubbo-samples-async-provider
   main_class: org.apache.dubbo.samples.async.AsyncProvider
   zookeeper_port: 2181
   dubbo_port: 20880

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to