You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by vi...@apache.org on 2019/03/08 02:21:53 UTC

[incubator-dubbo-samples] branch 2.6.x updated: make demo work

This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git


The following commit(s) were added to refs/heads/2.6.x by this push:
     new 78f88d0  make demo work
78f88d0 is described below

commit 78f88d02688ae626f642e96a7b095f117a3d3348
Author: cvictory <sh...@gmail.com>
AuthorDate: Fri Mar 8 10:21:29 2019 +0800

    make demo work
---
 .../dubbo/samples/api/client}/GreetingService.java |  7 +++++--
 dubbo-samples-zipkin/README.md                     |  2 +-
 .../org/apache/dubbo/samples/api/HelloService.java | 23 ----------------------
 .../samples/{ => zipkin}/client/Application.java   |  5 +++--
 .../{ => zipkin}/service/greeting/Application.java |  2 +-
 .../service/greeting/GreetingServiceImpl.java      |  8 ++++----
 .../{ => zipkin}/service/hello/Application.java    |  2 +-
 .../service/hello/HelloServiceImpl.java            |  6 +++---
 .../src/main/resources/spring/client.xml           |  6 ++++--
 .../src/main/resources/spring/greeting-service.xml | 10 ++++++----
 .../src/main/resources/spring/hello-service.xml    |  8 +++++---
 11 files changed, 33 insertions(+), 46 deletions(-)

diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/GreetingService.java b/dubbo-samples-api-client/src/main/java/org/apache/dubbo/samples/api/client/GreetingService.java
similarity index 91%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
rename to dubbo-samples-api-client/src/main/java/org/apache/dubbo/samples/api/client/GreetingService.java
index 3c2b67c..fbbc107 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/GreetingService.java
+++ b/dubbo-samples-api-client/src/main/java/org/apache/dubbo/samples/api/client/GreetingService.java
@@ -16,8 +16,11 @@
  *   limitations under the License.
  *
  */
-package org.apache.dubbo.samples.api;
+
+package org.apache.dubbo.samples.api.client;
 
 public interface GreetingService {
-    String greeting(String message);
+
+    String greeting(String name);
+
 }
diff --git a/dubbo-samples-zipkin/README.md b/dubbo-samples-zipkin/README.md
index 93fd37a..329ee61 100644
--- a/dubbo-samples-zipkin/README.md
+++ b/dubbo-samples-zipkin/README.md
@@ -53,7 +53,7 @@ mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.service.greeting.Applica
 Start client in command line, you can also start it directly from IDE:
 
 ```bash
-mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.client.Application
+mvn exec:java -Dexec.mainClass=org.apache.dubbo.samples.zipkin.client.Application
 ```
 
 "greeting, hello, world" should be print on the screen, then open http://localhost:9411 to check the trace. The sample trace in JSON format may look like this:
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/HelloService.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/HelloService.java
deleted file mode 100644
index e405347..0000000
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/api/HelloService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- *   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.
- *
- */
-package org.apache.dubbo.samples.api;
-
-public interface HelloService {
-    String hello(String message);
-}
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/client/Application.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/client/Application.java
similarity index 92%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/client/Application.java
rename to dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/client/Application.java
index c793b5a..ac1ed54 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/client/Application.java
+++ b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/client/Application.java
@@ -17,9 +17,10 @@
  *
  */
 
-package org.apache.dubbo.samples.client;
+package org.apache.dubbo.samples.zipkin.client;
+
+import org.apache.dubbo.samples.api.client.GreetingService;
 
-import org.apache.dubbo.samples.api.GreetingService;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class Application {
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/Application.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/Application.java
similarity index 95%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/Application.java
rename to dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/Application.java
index 628e130..dc05cec 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/Application.java
+++ b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/Application.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.dubbo.samples.service.greeting;
+package org.apache.dubbo.samples.zipkin.service.greeting;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/GreetingServiceImpl.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/GreetingServiceImpl.java
similarity index 84%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/GreetingServiceImpl.java
rename to dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/GreetingServiceImpl.java
index d8c545b..944cd5e 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/greeting/GreetingServiceImpl.java
+++ b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/greeting/GreetingServiceImpl.java
@@ -16,10 +16,10 @@
  *   limitations under the License.
  *
  */
-package org.apache.dubbo.samples.service.greeting;
+package org.apache.dubbo.samples.zipkin.service.greeting;
 
-import org.apache.dubbo.samples.api.GreetingService;
-import org.apache.dubbo.samples.api.HelloService;
+import org.apache.dubbo.samples.api.client.GreetingService;
+import org.apache.dubbo.samples.api.client.HelloService;
 
 import java.util.Random;
 
@@ -38,6 +38,6 @@ public class GreetingServiceImpl implements GreetingService {
         } catch (InterruptedException e) {
             // no op
         }
-        return "greeting, " + helloService.hello(message);
+        return "greeting, " + helloService.sayHello(message);
     }
 }
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/Application.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/Application.java
similarity index 95%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/Application.java
rename to dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/Application.java
index 9100785..9863118 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/Application.java
+++ b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/Application.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.dubbo.samples.service.hello;
+package org.apache.dubbo.samples.zipkin.service.hello;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
diff --git a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/HelloServiceImpl.java b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/HelloServiceImpl.java
similarity index 87%
rename from dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/HelloServiceImpl.java
rename to dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/HelloServiceImpl.java
index db91cba..8d750a2 100644
--- a/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/service/hello/HelloServiceImpl.java
+++ b/dubbo-samples-zipkin/src/main/java/org/apache/dubbo/samples/zipkin/service/hello/HelloServiceImpl.java
@@ -16,15 +16,15 @@
  *   limitations under the License.
  *
  */
-package org.apache.dubbo.samples.service.hello;
+package org.apache.dubbo.samples.zipkin.service.hello;
 
-import org.apache.dubbo.samples.api.HelloService;
+import org.apache.dubbo.samples.api.client.HelloService;
 
 import java.util.Random;
 
 public class HelloServiceImpl implements HelloService {
     @Override
-    public String hello(String message) {
+    public String sayHello(String message) {
         try {
             Thread.sleep(new Random(System.currentTimeMillis()).nextInt(1000));
         } catch (InterruptedException e) {
diff --git a/dubbo-samples-zipkin/src/main/resources/spring/client.xml b/dubbo-samples-zipkin/src/main/resources/spring/client.xml
index 942c7ee..84e2083 100644
--- a/dubbo-samples-zipkin/src/main/resources/spring/client.xml
+++ b/dubbo-samples-zipkin/src/main/resources/spring/client.xml
@@ -24,13 +24,15 @@
 
     <!-- consumer's application name, used for tracing dependency relationship (not a matching criterion),
     don't set it same as provider -->
-    <dubbo:application name="dubbo-client"/>
+    <dubbo:application name="dubbo-client">
+        <dubbo:parameter key="qos.port" value="22997"/>
+    </dubbo:application>
 
     <!-- use zookeeper registry center to discover service -->
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
 
     <!-- generate proxy for the remote service, then demoService can be used in the same way as the local regular interface -->
-    <dubbo:reference id="greetingService" check="false" interface="com.alibaba.dubbo.samples.api.GreetingService" filter="tracing"/>
+    <dubbo:reference id="greetingService" check="false" interface="org.apache.dubbo.samples.api.client.GreetingService" filter="tracing"/>
 
     <!-- zipkin configuration -->
     <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
diff --git a/dubbo-samples-zipkin/src/main/resources/spring/greeting-service.xml b/dubbo-samples-zipkin/src/main/resources/spring/greeting-service.xml
index 603de2f..9c47553 100644
--- a/dubbo-samples-zipkin/src/main/resources/spring/greeting-service.xml
+++ b/dubbo-samples-zipkin/src/main/resources/spring/greeting-service.xml
@@ -23,7 +23,9 @@
        http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
 
     <!-- provider's application name, used for tracing dependency relationship -->
-    <dubbo:application name="greeting-service-provider"/>
+    <dubbo:application name="greeting-service-provider">
+        <dubbo:parameter key="qos.port" value="33333"/>
+    </dubbo:application>
 
     <!-- use zookeeper registry center to export service -->
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
@@ -32,15 +34,15 @@
     <dubbo:protocol name="dubbo" port="20881"/>
 
     <!-- service implementation, as same as regular local bean -->
-    <bean id="greetingService" class="com.alibaba.dubbo.samples.service.greeting.GreetingServiceImpl">
+    <bean id="greetingService" class="org.apache.dubbo.samples.zipkin.service.greeting.GreetingServiceImpl">
         <property name="helloService" ref="helloService"/>
     </bean>
 
     <!-- declare the service interface to be exported -->
-    <dubbo:service interface="com.alibaba.dubbo.samples.api.GreetingService" ref="greetingService" filter="tracing"/>
+    <dubbo:service interface="org.apache.dubbo.samples.api.client.GreetingService" ref="greetingService" filter="tracing"/>
 
     <!-- generate proxy for the remote service, then helloService can be used in the same way as the local regular interface -->
-    <dubbo:reference id="helloService" check="false" interface="com.alibaba.dubbo.samples.api.HelloService" filter="tracing"/>
+    <dubbo:reference id="helloService" check="false" interface="org.apache.dubbo.samples.api.client.HelloService" filter="tracing"/>
 
     <!-- zipkin configuration -->
     <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
diff --git a/dubbo-samples-zipkin/src/main/resources/spring/hello-service.xml b/dubbo-samples-zipkin/src/main/resources/spring/hello-service.xml
index 518e090..467b17a 100644
--- a/dubbo-samples-zipkin/src/main/resources/spring/hello-service.xml
+++ b/dubbo-samples-zipkin/src/main/resources/spring/hello-service.xml
@@ -23,7 +23,9 @@
        http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
 
     <!-- provider's application name, used for tracing dependency relationship -->
-    <dubbo:application name="hello-service-provider"/>
+    <dubbo:application name="hello-service-provider">
+        <dubbo:parameter key="qos.port" value="22886"/>
+    </dubbo:application>
 
     <!-- use zookeeper registry center to export service -->
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
@@ -32,10 +34,10 @@
     <dubbo:protocol name="dubbo" port="20880"/>
 
     <!-- service implementation, as same as regular local bean -->
-    <bean id="helloService" class="com.alibaba.dubbo.samples.service.hello.HelloServiceImpl"/>
+    <bean id="helloService" class="org.apache.dubbo.samples.zipkin.service.hello.HelloServiceImpl"/>
 
     <!-- declare the service interface to be exported -->
-    <dubbo:service interface="com.alibaba.dubbo.samples.api.HelloService" ref="helloService" filter="tracing"/>
+    <dubbo:service interface="org.apache.dubbo.samples.api.client.HelloService" ref="helloService" filter="tracing"/>
 
     <!-- zipkin configuration -->
     <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org