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

liujun pushed a commit to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git


The following commit(s) were added to refs/heads/samples-for-2.7.0-SNAPSHOT by 
this push:
     new 89161fc  fix async and configcenter samples
89161fc is described below

commit 89161fc112fcdeb58c7a57a7bfc87f3461cdc3f2
Author: ken.lj <[email protected]>
AuthorDate: Fri Jan 11 10:49:58 2019 +0800

    fix async and configcenter samples
---
 .../dubbo/samples/governance/AsyncConsumer.java    |  5 +-
 .../governance/filter/AsyncPostprocessFilter.java  | 13 ++--
 ...stprocessFilter.java => LegacyBlockFilter.java} | 18 +++--
 .../samples/governance/impl/AsyncServiceImpl.java  |  2 +-
 .../META-INF/dubbo/org.apache.dubbo.rpc.Filter     |  3 +-
 .../resources/META-INF/spring/async-consumer.xml   |  2 +-
 .../resources/META-INF/spring/async-provider.xml   |  2 +-
 .../samples/governance/impl/AsyncServiceImpl.java  |  2 +-
 .../resources/META-INF/spring/async-consumer.xml   |  2 +-
 .../resources/META-INF/spring/async-provider.xml   |  4 +-
 .../dubbo/samples/governance/AsyncConsumer.java    |  2 +-
 .../src/main/resources/spring/async-consumer.xml   |  2 +-
 .../src/main/resources/spring/async-provider.xml   |  4 +-
 .../org/apache/dubbo/samples/api/DemoService.java  | 24 +++++++
 .../dubbo/samples/server/DemoServiceImpl.java      | 29 ++++++++
 .../samples/server/MultipleServiceProvider.java    | 79 ++++++++++++++++++++++
 .../src/main/resources/log4j.properties            | 25 +++++++
 .../multiregistries}/AnnotationConsumer.java       |  8 +--
 .../multiregistries}/AnnotationProvider.java       |  4 +-
 .../multiregistries}/EmbeddedZooKeeper.java        |  2 +-
 .../multiregistries}/ZKTools.java                  |  5 +-
 .../multiregistries}/action/AnnotationAction.java  |  4 +-
 .../multiregistries}/api/AnnotationService.java    |  2 +-
 .../impl/AnnotationServiceImpl.java                |  6 +-
 .../apache/dubbo/samples/configcenter/ZKTools.java |  7 +-
 .../META-INF/spring/configcenter-consumer.xml      |  2 +-
 26 files changed, 210 insertions(+), 48 deletions(-)

diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
index 7a48b9a..8fc5521 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
@@ -21,6 +21,7 @@ package org.apache.dubbo.samples.governance;
 
 import org.apache.dubbo.rpc.RpcContext;
 import org.apache.dubbo.samples.governance.api.AsyncService;
+
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import java.util.concurrent.CompletableFuture;
@@ -44,10 +45,10 @@ public class AsyncConsumer {
             if (t != null) {
                 t.printStackTrace();
             } else {
-                System.out.println("Response: " + v);
+                System.out.println("AsyncConsumer: Response: " + v);
             }
         });
-        System.out.println("Executed before response return.");
+        System.out.println("AsyncConsumer: Executed before response return.");
 
         System.in.read();
     }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
index 6739b3d..d89a39c 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
@@ -30,15 +30,14 @@ import org.apache.dubbo.rpc.RpcException;
 @Activate(group = {Constants.PROVIDER, Constants.CONSUMER})
 public class AsyncPostprocessFilter implements Filter {
     @Override
-    public Result onResponse(Result result, Invoker<?> invoker, Invocation 
invocation) {
-        System.out.println(Thread.currentThread().getName());
-        System.out.println("Filter get the return value: " + 
result.getValue());
-        return result;
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
+        return invoker.invoke(invocation);
     }
 
     @Override
-    public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
-        System.out.println(Thread.currentThread().getName());
-        return invoker.invoke(invocation);
+    public Result onResponse(Result result, Invoker<?> invoker, Invocation 
invocation) {
+        System.out.println("AsyncPostprocessFilter: Filter get the return 
value: " + result.getValue());
+        return result;
     }
+
 }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/LegacyBlockFilter.java
similarity index 74%
copy from 
dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
copy to 
dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/LegacyBlockFilter.java
index 6739b3d..b39f1db 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/AsyncPostprocessFilter.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/filter/LegacyBlockFilter.java
@@ -28,17 +28,15 @@ import org.apache.dubbo.rpc.RpcException;
  *
  */
 @Activate(group = {Constants.PROVIDER, Constants.CONSUMER})
-public class AsyncPostprocessFilter implements Filter {
-    @Override
-    public Result onResponse(Result result, Invoker<?> invoker, Invocation 
invocation) {
-        System.out.println(Thread.currentThread().getName());
-        System.out.println("Filter get the return value: " + 
result.getValue());
-        return result;
-    }
-
+public class LegacyBlockFilter implements Filter {
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
-        System.out.println(Thread.currentThread().getName());
-        return invoker.invoke(invocation);
+        Result result =  invoker.invoke(invocation);
+        System.out.println("LegacyBlockFilter: This is the default return 
value: " + result.getValue());
+        if (result.hasException()) {
+            System.out.println("LegacyBlockFilter: This will only happen when 
the real exception returns: " + result.getException());
+        }
+        System.err.println("LegacyBlockFilter: This msg should not be 
blocked.");
+        return result;
     }
 }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
index 716c2de..ae28e50 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
@@ -37,7 +37,7 @@ public class AsyncServiceImpl implements AsyncService {
             System.out.println(savedContext.getAttachment("consumer-key1"));
             savedServerContext.setAttachment("server-key1", "server-value1");
             try {
-                Thread.sleep(5000);
+                Thread.sleep(10000);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
index 0741d6e..6c71534 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
@@ -1 +1,2 @@
-asyncpostprocess=org.apache.dubbo.samples.governance.filter.AsyncPostprocessFilter
\ No newline at end of file
+asyncpostprocess=org.apache.dubbo.samples.governance.filter.AsyncPostprocessFilter
+logacy-block=org.apache.dubbo.samples.governance.filter.LegacyBlockFilter
\ No newline at end of file
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-consumer.xml
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-consumer.xml
index 9ad62c5..5dcab70 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-consumer.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-consumer.xml
@@ -28,7 +28,7 @@
 
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
 
-    <dubbo:reference id="asyncService" timeout="10000"
+    <dubbo:reference id="asyncService" timeout="20000"
                      
interface="org.apache.dubbo.samples.governance.api.AsyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-provider.xml
 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-provider.xml
index c1467c4..e40a162 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-provider.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-original-future/src/main/resources/META-INF/spring/async-provider.xml
@@ -32,6 +32,6 @@
 
     <bean id="asyncService" 
class="org.apache.dubbo.samples.governance.impl.AsyncServiceImpl"/>
 
-    <dubbo:service async="true" 
interface="org.apache.dubbo.samples.governance.api.AsyncService" 
ref="asyncService"/>
+    <dubbo:service 
interface="org.apache.dubbo.samples.governance.api.AsyncService" 
ref="asyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
index 4fe5562..7bdf02e 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/java/org/apache/dubbo/samples/governance/impl/AsyncServiceImpl.java
@@ -37,7 +37,7 @@ public class AsyncServiceImpl implements AsyncService {
             System.out.println("Attachment from consumer: " + 
RpcContext.getContext().getAttachment("consumer-key1"));
             System.out.println("    -- Async start.");
             try {
-                Thread.sleep(500);
+                Thread.sleep(5000);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
diff --git 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-consumer.xml
 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-consumer.xml
index 6856cfa..fdb74e3 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-consumer.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-consumer.xml
@@ -28,6 +28,6 @@
 
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
 
-    <dubbo:reference id="asyncService" interface="AsyncService"/>
+    <dubbo:reference id="asyncService" 
interface="org.apache.dubbo.samples.governance.api.AsyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-provider.xml
 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-provider.xml
index c99868c..e40a162 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-provider.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-provider/src/main/resources/META-INF/spring/async-provider.xml
@@ -30,8 +30,8 @@
 
     <dubbo:protocol name="dubbo" port="20880"/>
 
-    <bean id="asyncService" class="AsyncServiceImpl"/>
+    <bean id="asyncService" 
class="org.apache.dubbo.samples.governance.impl.AsyncServiceImpl"/>
 
-    <dubbo:service async="true" interface="AsyncService" ref="asyncService"/>
+    <dubbo:service 
interface="org.apache.dubbo.samples.governance.api.AsyncService" 
ref="asyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
index ea91d76..671c13e 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
+++ 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/java/org/apache/dubbo/samples/governance/AsyncConsumer.java
@@ -21,6 +21,7 @@ package org.apache.dubbo.samples.governance;
 
 import org.apache.dubbo.rpc.RpcContext;
 import org.apache.dubbo.samples.governance.api.AsyncService;
+
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import java.util.concurrent.Future;
@@ -43,7 +44,6 @@ public class AsyncConsumer {
 
         RpcContext.getContext().asyncCall(() -> {
             asyncService.sayHello("oneway call request1");
-            asyncService.sayHello("oneway call request2");
         });
 
         System.in.read();
diff --git 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-consumer.xml
 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-consumer.xml
index 8e13fc2..40c586b 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-consumer.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-consumer.xml
@@ -28,6 +28,6 @@
 
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
 
-    <dubbo:reference id="asyncService" interface="AsyncService"/>
+    <dubbo:reference id="asyncService" 
interface="org.apache.dubbo.samples.governance.api.AsyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-provider.xml
 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-provider.xml
index 9627884..24f034d 100644
--- 
a/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-provider.xml
+++ 
b/dubbo-samples-async/dubbo-samples-async-simple/src/main/resources/spring/async-provider.xml
@@ -30,8 +30,8 @@
 
     <dubbo:protocol name="dubbo" port="20880"/>
 
-    <bean id="asyncService" class="AsyncServiceImpl"/>
+    <bean id="asyncService" 
class="org.apache.dubbo.samples.governance.impl.AsyncServiceImpl"/>
 
-    <dubbo:service interface="AsyncService" ref="asyncService"/>
+    <dubbo:service 
interface="org.apache.dubbo.samples.governance.api.AsyncService" 
ref="asyncService"/>
 
 </beans>
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/api/DemoService.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/api/DemoService.java
new file mode 100644
index 0000000..5fb553e
--- /dev/null
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/api/DemoService.java
@@ -0,0 +1,24 @@
+/*
+ * 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 DemoService {
+    String sayHello();
+}
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/DemoServiceImpl.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/DemoServiceImpl.java
new file mode 100644
index 0000000..7ab4f2e
--- /dev/null
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/DemoServiceImpl.java
@@ -0,0 +1,29 @@
+/*
+ * 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.server;
+
+import org.apache.dubbo.samples.api.DemoService;
+
+/**
+ *
+ */
+public class DemoServiceImpl implements DemoService {
+    @Override
+    public String sayHello() {
+        return "Hello, you!";
+    }
+}
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/MultipleServiceProvider.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/MultipleServiceProvider.java
new file mode 100644
index 0000000..f46786b
--- /dev/null
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/MultipleServiceProvider.java
@@ -0,0 +1,79 @@
+/*
+ * 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.server;
+
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ConfigCenterConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.samples.api.DemoService;
+import org.apache.dubbo.samples.api.GreetingsService;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MultipleServiceProvider {
+    private static ConfigCenterConfig configCenter = new ConfigCenterConfig();
+    private static ApplicationConfig application = new 
ApplicationConfig("api-dubbo-provider");
+    private static RegistryConfig registry1 = new RegistryConfig();
+    private static RegistryConfig registry2 = new RegistryConfig();
+
+    static {
+        configCenter.setExternalConfig(getExternalConfiguration());
+        registry1.setAddress("zookeeper://127.0.0.1:2181");
+        registry2.setAddress("zookeeper://127.0.0.1:2181");
+    }
+
+    public static void main(String[] args) throws Exception {
+        ServiceConfig<GreetingsService> greetingsService = new 
ServiceConfig<>();
+        greetingsService.setApplication(application);
+        greetingsService.setConfigCenter(configCenter);
+        greetingsService.setRegistries(Arrays.asList(registry1, registry2));
+        greetingsService.setInterface(GreetingsService.class);
+        greetingsService.setRef(new GreetingsServiceImpl());
+        greetingsService.export();
+
+        ServiceConfig<DemoService> demoService = new ServiceConfig<>();
+        demoService.setApplication(application);
+        demoService.setConfigCenter(configCenter);
+        demoService.setInterface(DemoService.class);
+        demoService.setRegistries(Arrays.asList(registry1, registry2));
+        demoService.setRef(new DemoServiceImpl());
+        demoService.export();
+
+        System.out.println("Dubbo provider started successfully!");
+        System.in.read();
+    }
+
+    /**
+     * If you don't want to use ConfigCenter provided by dubbo, you can set 
external configuration to Dubbo directly.
+     * In this sample, we created a Map instance manually and put a value into 
it, but in reality,
+     * the external configurations will most likely being generated from other 
plugins in your system.
+     */
+    public static Map<String, String> getExternalConfiguration() {
+        Map<String, String> dubboConfigurations = new HashMap<>();
+        dubboConfigurations.put("dubbo.registry.address", 
"zookeeper://127.0.0.1:2181");
+        // you will need to add the configcenter address if you want to use 
the service governance features in 2.7, e.g., overrides and routers.
+        // but notice it will not be used for gathering startup configurations.
+        dubboConfigurations.put("dubbo.configcenter.address", 
"zookeeper://127.0.0.1:2181");
+
+        return dubboConfigurations;
+    }
+}
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/resources/log4j.properties
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/resources/log4j.properties
new file mode 100644
index 0000000..e976f5c
--- /dev/null
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/resources/log4j.properties
@@ -0,0 +1,25 @@
+#
+#
+#   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.
+#  
+#
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] 
%t %5p %c{2}: %m%n
\ No newline at end of file
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationConsumer.java
similarity index 84%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationConsumer.java
index 58a6e9c..2d4cdca 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationConsumer.java
@@ -17,10 +17,10 @@
  *
  */
 
-package org.apache.dubbo.samples.hystrix.annotation;
+package org.apache.dubbo.samples.configcenter.multiregistries;
 
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.apache.dubbo.samples.hystrix.annotation.action.AnnotationAction;
+import 
org.apache.dubbo.samples.configcenter.multiregistries.action.AnnotationAction;
 
 import 
org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.ComponentScan;
@@ -42,9 +42,9 @@ public class AnnotationConsumer {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = 
"org.apache.dubbo.samples.annotation.action")
+    @EnableDubbo(scanBasePackages = 
"org.apache.dubbo.samples.configcenter.multiregistries.action")
     @PropertySource("classpath:/spring/dubbo-consumer.properties")
-    @ComponentScan(value = {"org.apache.dubbo.samples.annotation.action"})
+    @ComponentScan(value = 
{"org.apache.dubbo.samples.configcenter.multiregistries.action"})
     static public class ConsumerConfiguration {
 
     }
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationProvider.java
similarity index 92%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationProvider.java
index 1d20827..017962f 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/AnnotationProvider.java
@@ -17,7 +17,7 @@
  *
  */
 
-package org.apache.dubbo.samples.hystrix.annotation;
+package org.apache.dubbo.samples.configcenter.multiregistries;
 
 
 import org.apache.dubbo.config.ProviderConfig;
@@ -41,7 +41,7 @@ public class AnnotationProvider {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.annotation.impl")
+    @EnableDubbo(scanBasePackages = 
"org.apache.dubbo.samples.configcenter.multiregistries.impl")
     @PropertySource("classpath:/spring/dubbo-provider.properties")
     static public class ProviderConfiguration {
         @Bean
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/EmbeddedZooKeeper.java
similarity index 99%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/EmbeddedZooKeeper.java
index 64335ba..124b208 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/EmbeddedZooKeeper.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.hystrix.annotation;
+package org.apache.dubbo.samples.configcenter.multiregistries;
 
 import org.apache.zookeeper.server.ServerConfig;
 import org.apache.zookeeper.server.ZooKeeperServerMain;
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/ZKTools.java
similarity index 92%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/ZKTools.java
index 01e4655..e264722 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/ZKTools.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.hystrix.annotation;
+package org.apache.dubbo.samples.configcenter.multiregistries;
 
 import org.apache.dubbo.common.utils.StringUtils;
 
@@ -36,7 +36,8 @@ public class ZKTools {
     }
 
     public static void generateDubboPropertiesForGlobal() {
-        String str = 
"dubbo.registries.registry1.address=zookeeper://127.0.0.1:2181\n" + 
"dubbo.registries.registry2.address=zookeeper://127.0.0.1:2182\n";
+        String str = 
"dubbo.registries.registry1.address=zookeeper://127.0.0.1:2181\n" +
+                
"dubbo.registries.registry2.address=zookeeper://127.0.0.1:2181\n";
 
         System.out.println(str);
 
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/action/AnnotationAction.java
similarity index 88%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/action/AnnotationAction.java
index f96c885..2ed6e58 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/action/AnnotationAction.java
@@ -17,10 +17,10 @@
  *
  */
 
-package org.apache.dubbo.samples.hystrix.annotation.action;
+package org.apache.dubbo.samples.configcenter.multiregistries.action;
 
 import org.apache.dubbo.config.annotation.Reference;
-import org.apache.dubbo.samples.hystrix.annotation.api.AnnotationService;
+import 
org.apache.dubbo.samples.configcenter.multiregistries.api.AnnotationService;
 
 import org.springframework.stereotype.Component;
 
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/api/AnnotationService.java
similarity index 93%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/api/AnnotationService.java
index ebaeae5..2608a03 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/api/AnnotationService.java
@@ -17,7 +17,7 @@
  *
  */
 
-package org.apache.dubbo.samples.hystrix.annotation.api;
+package org.apache.dubbo.samples.configcenter.multiregistries.api;
 
 /**
  * AsyncService
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/impl/AnnotationServiceImpl.java
similarity index 87%
rename from 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
rename to 
dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/impl/AnnotationServiceImpl.java
index ef85f11..7859271 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/configcenter/multiregistries/impl/AnnotationServiceImpl.java
@@ -17,15 +17,15 @@
  *
  */
 
-package org.apache.dubbo.samples.hystrix.annotation.impl;
+package org.apache.dubbo.samples.configcenter.multiregistries.impl;
 
 import org.apache.dubbo.config.annotation.Service;
-import org.apache.dubbo.samples.hystrix.annotation.api.AnnotationService;
+import 
org.apache.dubbo.samples.configcenter.multiregistries.api.AnnotationService;
 
 /**
  * AsyncServiceImpl
  */
-@Service(registry = "registry1")
+@Service
 public class AnnotationServiceImpl implements AnnotationService {
 
     @Override
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/java/org/apache/dubbo/samples/configcenter/ZKTools.java
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/java/org/apache/dubbo/samples/configcenter/ZKTools.java
index 5bed08f..456c1b2 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/java/org/apache/dubbo/samples/configcenter/ZKTools.java
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/java/org/apache/dubbo/samples/configcenter/ZKTools.java
@@ -36,7 +36,12 @@ public class ZKTools {
     }
 
     public static void generateDubboPropertiesForGlobal() {
-        String str = "#key: dubbo.{item-name}.{id}.{property}\n" + 
"dubbo.registry.address=zookeeper://127.0.0.1:2181\n" + 
"dubbo.protocols.dubbo1.name=dubbo\n" + "dubbo.protocols.dubbo1.port=20991\n" + 
"dubbo.protocols.hessian1.name=hessian\n" + 
"dubbo.protocols.hessian1.port=8089";
+        String str = "#key: dubbo.{item-name}.{id}.{property}\n" +
+                "dubbo.registry.address=zookeeper://127.0.0.1:2181\n" +
+                "dubbo.protocols.dubbo1.name=dubbo\n" +
+                "dubbo.protocols.dubbo1.port=20991\n" +
+                "dubbo.protocols.hessian1.name=hessian\n" +
+                "dubbo.protocols.hessian1.port=8089";
 
         System.out.println(str);
 
diff --git 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/META-INF/spring/configcenter-consumer.xml
 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/META-INF/spring/configcenter-consumer.xml
index e330a49..6ddadf4 100644
--- 
a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/META-INF/spring/configcenter-consumer.xml
+++ 
b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/META-INF/spring/configcenter-consumer.xml
@@ -28,7 +28,7 @@
 
     <dubbo:config-center address="zookeeper://127.0.0.1:2181"/>
 
-    <dubbo:reference id="demoService" protocol="hessian"
+    <dubbo:reference id="demoService" protocol="dubbo"
                      
interface="org.apache.dubbo.samples.configcenter.api.DemoService"/>
 
 </beans>
\ No newline at end of file


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

Reply via email to