[incubator-dubbo-website] branch asf-site updated: add blog

2018-08-10 Thread jerrick
This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 7e0e10f  add blog
7e0e10f is described below

commit 7e0e10fffb435624bead7df865c8ff5e1eb28483
Author: zhuyong 
AuthorDate: Fri Aug 10 16:39:53 2018 +0800

add blog
---
 blog/zh-cn/dubbo-integrate-with-hystrix.md | 201 +
 ...c3831ea1057a5367.js => 4828dc59b19c927e111e.js} |   4 +-
 build/654055e491fb5dea7da2.js  |   6 +
 build/fca877d6ab8a5dbba7ca.js  |   6 -
 build/page.js  |   2 +-
 md_json/blog.json  |   4 +
 site_config/blog.js|   7 +
 7 files changed, 221 insertions(+), 9 deletions(-)

diff --git a/blog/zh-cn/dubbo-integrate-with-hystrix.md 
b/blog/zh-cn/dubbo-integrate-with-hystrix.md
new file mode 100644
index 000..34d9a2b
--- /dev/null
+++ b/blog/zh-cn/dubbo-integrate-with-hystrix.md
@@ -0,0 +1,201 @@
+# Spring应用快速集成Dubbo + Hystrix
+
+## 背景
+
+Hystrix 
旨在通过控制那些访问远程系统、服务和第三方库的节点,从而对延迟和故障提供更强大的容错能力。Hystrix具备拥有回退机制和断路器功能的线程和信号隔离,请求缓存和请求打包,以及监控和配置等功能。
+
+Dubbo是Alibaba开源的,目前国内最流行的java rpc框架。
+
+本文介绍在spring应用里,怎么把Dubbo和Hystrix结合起来使用。
+
+- 
+- 
+
+## Spring Boot应用
+
+Demo地址: 

+
+### 生成dubbo集成spring boot的应用
+
+对于不熟悉dubbo 集成spring boot应用的同学,可以在这里直接生成dubbo + spring boot的工程: 

+
+### 配置spring-cloud-starter-netflix-hystrix
+
+spring boot官方提供了对hystrix的集成,直接在pom.xml里加入依赖:
+
+```
+
+org.springframework.cloud
+spring-cloud-starter-netflix-hystrix
+1.4.4.RELEASE
+
+```
+
+然后在Application类上增加`@EnableHystrix`来启用hystrix starter:
+
+```
+@SpringBootApplication
+@EnableHystrix
+public class ProviderApplication {
+```
+
+### 配置Provider端
+
+在Dubbo的Provider上增加`@HystrixCommand`配置,这样子调用就会经过Hystrix代理。
+
+```
+@Service(version = "1.0.0")
+public class HelloServiceImpl implements HelloService {
+@HystrixCommand(commandProperties = {
+@HystrixProperty(name = 
"circuitBreaker.requestVolumeThreshold", value = "10"),
+@HystrixProperty(name = 
"execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
+@Override
+public String sayHello(String name) {
+// System.out.println("async provider received: " + name);
+// return "annotation: hello, " + name;
+throw new RuntimeException("Exception to show hystrix enabled.");
+}
+}
+```
+
+### 配置Consumer端
+
+对于Consumer端,则可以增加一层method调用,并在method上配置`@HystrixCommand`。当调用出错时,会走到`fallbackMethod
 = "reliable"`的调用里。
+
+```
+@Reference(version = "1.0.0")
+private HelloService demoService;
+
+@HystrixCommand(fallbackMethod = "reliable")
+public String doSayHello(String name) {
+return demoService.sayHello(name);
+}
+public String reliable(String name) {
+return "hystrix fallback value";
+}
+```
+
+通过上面的配置,很简单地就完成了Spring Boot里Dubbo + Hystrix的集成。
+
+## 传统Spring Annotation应用
+
+Demo地址: 

+
+传统spring annotation应用的配置其实也很简单,和spring boot应用不同的是:
+
+1. 显式配置Spring AOP支持:`@EnableAspectJAutoProxy`
+2. 显式通过`@Configuration`配置`HystrixCommandAspect` Bean。
+
+```
+@Configuration
+@EnableDubbo(scanBasePackages = 
"com.alibaba.dubbo.samples.annotation.action")
+@PropertySource("classpath:/spring/dubbo-consumer.properties")
+@ComponentScan(value = {"com.alibaba.dubbo.samples.annotation.action"})
+@EnableAspectJAutoProxy
+static public class ConsumerConfiguration {
+
+@Bean
+public HystrixCommandAspect hystrixCommandAspect() {
+return new HystrixCommandAspect();
+}
+}
+```
+
+## Hystrix集成Spring AOP原理
+
+在上面的例子里可以看到,Hystrix对Spring的集成是通过Spring AOP来实现的。下面简单分析下实现。
+
+```
+@Aspect
+public class HystrixCommandAspect {
+
@Pointcut("@annotation(com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand)")
+public void hystrixCommandAnnotationPointcut() {
+}
+
@Pointcut("@annotation(com.netflix.hystrix.contrib.javanica.annotation.HystrixCollapser)")
+public void hystrixCollapserAnnotationPointcut() {
+}
+
+@Around("hystrixCommandAnnotationPointcut() || 
hystrixCollapserAnnotationPointcut()")
+public Object methodsAnnotatedWithHystrixCommand(final ProceedingJoinPoint 
joinPoint) throws Throwable {
+Method method = getMethodFromTarget(joinPoint);
+Validate.notNull(method, "failed to get method from joinPoint: %s", 
joinPoint);
+if (method.isAnnotationPresent(HystrixCommand.class) && 

[incubator-dubbo-website] branch asf-site updated: build

2018-08-10 Thread jerrick
This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 40bcee1  build
40bcee1 is described below

commit 40bcee17793df20281bcb9b6edcbf1ed626f54f2
Author: zhuyong 
AuthorDate: Fri Aug 10 16:33:30 2018 +0800

build
---
 blog/zh-cn/dubbo-loadbalance.md| 265 ++
 blog/zh-cn/dubbo-new-async.md  | 556 +
 build/0d69326d69fd47b9d99a.js  |   6 -
 ...8f548578cb3c9f5b.js => 5dfcc3831ea1057a5367.js} |   2 +-
 build/fca877d6ab8a5dbba7ca.js  |   6 +
 build/page.js  |   2 +-
 md_json/blog.json  |   4 +-
 site_config/blog.js|   2 +-
 8 files changed, 832 insertions(+), 11 deletions(-)

diff --git a/blog/zh-cn/dubbo-loadbalance.md b/blog/zh-cn/dubbo-loadbalance.md
index e69de29..65aa757 100644
--- a/blog/zh-cn/dubbo-loadbalance.md
+++ b/blog/zh-cn/dubbo-loadbalance.md
@@ -0,0 +1,265 @@
+# Dubbo的负载均衡
+
+# 背景
+
+Dubbo是一个分布式服务框架,能避免单点故障和支持服务的横向扩容。一个服务通常会部署多个实例。如何从多个服务提供者组成的集群中挑选出一个进行调用,就涉及到一个负载均衡的策略。
+
+# 几个概念
+
+在讨论负载均衡之前,我想先解释一下这3个概念。
+
+1. 负载均衡
+2. 集群容错
+3. 服务路由
+
+这3个概念容易混淆。他们都描述了怎么从多个Provider中选择一个来进行调用。那他们到底有什么区别呢?下面我来举一个简单的例子,把这几个概念阐述清楚吧。
+
+有一个Dubbo的用户服务,在北京部署了10个,在上海部署了20个。一个杭州的服务消费方发起了一次调用,然后发生了以下的事情:
+
+1. 根据配置的路由规则,如果杭州发起的调用,会路由到比较近的上海的20个Provider。
+2. 根据配置的随机负载均衡策略。在20个Provider中随机选择了一个来调用,假设随机到了第7个Provider。
+3. 结果调用第7个Provider失败了。
+4. 根据配置的Failover集群容错模式,重试其他服务器。
+5. 重试了第13个Provider,调用成功。
+
+上面的第1,2,4步骤就分别对应了路由,负载均衡和集群容错。 
Dubbo中,先通过路由,从多个Provider中按照路由规则,选出一个子集。再根据负载均衡从子集中选出一个Provider进行本次调用。如果调用失败了,根据集群容错策略,进行重试或定时重发或快速失败等。
 可以看到Dubbo中的路由,负载均衡和集群容错发生在一次RPC调用的不同阶段。最先是路由,然后是负载均衡,最后是集群容错。 
本文档只讨论负载均衡,路由和集群容错在其他的文档中进行说明。
+
+# Dubbo内置负载均衡策略
+
+Dubbo内置了4种负载均衡策略:
+
+1. RandomLoadBalance:随机负载均衡。随机的选择一个。是Dubbo的**默认**负载均衡策略。
+2. RoundRobinLoadBalance:轮询负载均衡。轮询选择一个。
+3. 
LeastActiveLoadBalance:最少活跃调用数,相同活跃数的随机,活跃数指调用前后计数差。使慢的提供者收到更少请求,因为越慢的提供者的调用前后计数差会越大。
+4. ConsistentHashLoadBalance:一致性哈希负载均衡。相同参数的请求总是落在同一台机器上。
+
+### 1.随机负载均衡
+
+顾名思义,随机负载均衡策略就是从多个Provider中随机选择一个。但是Dubbo中的随机负载均衡有一个权重的概念,即按照权重设置随机概率。比如说,有10个Provider,并不是说,每个Provider的概率都是一样的,而是要结合这10个provider的权重来分配概率。
+
+Dubbo中,可以对Provider设置权重。比如机器性能好的,可以设置大一点的权重,性能差的,可以设置小一点的权重。权重会对负载均衡产生影响。可以在Dubbo
 Admin中对provider进行权重的设置。
+
+**基于权重的负载均衡算法**
+
+随机策略会先判断所有的invoker的权重是不是一样的,如果都是一样的,那么处理就比较简单了。使用random.nexInt(length)就可以随机生成一个invoker的序号,根据序号选择对应的invoker。如果没有在Dubbo
 Admin中对服务提供者设置权重,那么所有的invoker的权重就是一样的,默认是100。 如果权重不一样,那就需要结合权重来设置随机概率了。算法大概如下: 
假如有4个invoker
+
+| invoker | weight |
+| --- | -- |
+| A   | 10 |
+| B   | 20 |
+| C   | 20 |
+| D   | 30 |
+
+A,B,C和D总的权重是10 + 20 + 20 + 30 = 80。将80个数分布在如下的图中:
+
+```
++---+
+|  ||| 
 |
++---+
+1  10   30   50
 80
+
+|-A|-B--|--C-|---D--|
+
+
+-15
+
+---37
+
+---54
+```
+
+上面的图中一共有4块区域,长度分别是A,B,C和D的权重。使用random.nextInt(10 + 20 + 20 + 
30),从80个数中随机选择一个。然后再判断该数分布在哪个区域。比如,如果随机到37,37是分布在C区域的,那么就选择inboker 
C。15是在B区域,54是在D区域。
+
+**随机负载均衡源码**
+
+下面是随机负载均衡的源码,为了方便阅读和理解,我把无关部分都去掉了。
+
+```
+public class RandomLoadBalance extends AbstractLoadBalance {
+
+private final Random random = new Random();
+
+protected  Invoker doSelect(List> invokers, URL url, 
Invocation invocation) {
+int length = invokers.size();  // invoker总数
+int totalWeight = 0;   // 所有invoker的权重的和
+
+// 判断是不是所有的invoker的权重都是一样的
+// 如果权重都一样,就简单了。直接用Random生成索引就可以了。
+boolean sameWeight = true; 
+for (int i = 0; i < length; i++) {
+int weight = getWeight(invokers.get(i), invocation);
+totalWeight += weight; // Sum
+if (sameWeight && i > 0 && weight != getWeight(invokers.get(i - 
1), invocation)) {
+sameWeight = false;
+}
+}
+
+if (totalWeight > 0 && !sameWeight) {
+// 如果不是所有的invoker权重都相同,那么基于权重来随机选择。权重越大的,被选中的概率越大
+int offset = random.nextInt(totalWeight);
+for (int i = 0; i < length; i++) {
+offset -= getWeight(invokers.get(i), invocation);
+if (offset < 0) {
+return invokers.get(i);
+}
+}
+}
+// 如果所有invoker权重相同
+return 

[incubator-dubbo-website] branch asf-site updated: build

2018-08-10 Thread jerrick
This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 9d6de5e  build
9d6de5e is described below

commit 9d6de5e08f17f3200c70b2f694c1eb5b208b2e53
Author: zhuyong 
AuthorDate: Fri Aug 10 16:17:52 2018 +0800

build
---
 build/0d69326d69fd47b9d99a.js |  6 ++
 build/197de76506a1ddd84a4b.js |  6 --
 build/364a8f548578cb3c9f5b.js |  6 ++
 build/74188657de05e5b92cf4.js |  6 --
 build/7533f0a0e44a4367de8b.js |  6 ++
 build/87c67c0d7caf73d7e493.js |  6 --
 build/8b66bddd9274404f5cad.js |  6 --
 build/c3e013b93dbf5fac1c23.js |  6 ++
 build/c5ce7257df274bc595ec.js |  6 --
 build/e52128c6c5682a86685a.js |  6 ++
 build/page.js |  2 +-
 md_json/blog.json | 14 +-
 12 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/build/0d69326d69fd47b9d99a.js b/build/0d69326d69fd47b9d99a.js
new file mode 100644
index 000..30ab02d
--- /dev/null
+++ b/build/0d69326d69fd47b9d99a.js
@@ -0,0 +1,6 @@
+webpackJsonp([1],[function(s,n,e){"use strict";function a(s){return 
s&__esModule?s:{default:s}}function t(s,n){if(!(s instanceof n))throw new 
TypeError("Cannot call a class as a function")}function o(s,n){if(!s)throw new 
ReferenceError("this hasn't been initialised - super() hasn't been 
called");return!n||"object"!=typeof n&&"function"!=typeof n?s:n}function 
l(s,n){if("function"!=typeof n&!==n)throw new TypeError("Super expression 
must either be null or a function, not "+ [...]
+  Copyright (c) 2017 Jed Watson.
+  Licensed under the MIT License (MIT), see
+  http://jedwatson.github.io/classnames
+*/
+!function(){"use strict";function e(){for(var 
s=[],n=0;nhttp://jedwatson.github.io/classnames
-*/
-!function(){"use strict";function n(){for(var 
e=[],t=0;thttp://jedwatson.github.io/classnames
+*/
+!function(){"use strict";function n(){for(var 
e=[],t=0;thttp://jedwatson.github.io/classnames
-*/
-!function(){"use strict";function e(){for(var 
s=[],n=0;nhttp://jedwatson.github.io/classnames
+*/
+!function(){"use strict";function n(){for(var 
e=[],t=0;thttp://jedwatson.github.io/classnames
-*/
-!function(){"use strict";function n(){for(var 
e=[],t=0;thttp://jedwatson.github.io/classnames
-*/
-!function(){"use strict";function n(){for(var 
e=[],t=0;thttp://jedwatson.github.io/classnames
+*/
+!function(){"use strict";function a(){for(var 
s=[],n=0;nhttp://jedwatson.github.io/classnames
-*/
-!function(){"use strict";function a(){for(var 
s=[],n=0;nhttp://jedwatson.github.io/classnames
+*/
+!function(){"use strict";function n(){for(var 
e=[],t=0;t理解Apache发布的内容和流程\n总的来说,Source 
Release是Apache关注的重点,也是发布的必须内容;而Binary 
Release是可选项,Dubbo可以选择是否发布二进制包到Apache仓库或者发布到Maven中央仓库。\n请参考以下链接,找到更多关于ASF的发布指南:\n\nhttp://www.apache.org/dev/release-publishing\;>Apache Release 
Guide\nhttp://www.apache.org/dev/release.html\;>Apache 
Release Policy\nhttp://www.apache.org/dev/publishing-maven-artifacts.html\;>Maven 
Release Info\n\n本地构建环 [...]
+  "__html": "理解Apache发布的内容和流程\n总的来说,Source 
Release是Apache关注的重点,也是发布的必须内容;而Binary 
Release是可选项,Dubbo可以选择是否发布二进制包到Apache仓库或者发布到Maven中央仓库。\n请参考以下链接,找到更多关于ASF的发布指南:\n\nhttp://www.apache.org/dev/release-publishing\;>Apache Release 
Guide\nhttp://www.apache.org/dev/release.html\;>Apache 
Release Policy\nhttp://www.apache.org/dev/publishing-maven-artifacts.html\;>Maven 
Release Info\n\n本地构建环 [...]
 },
 {
   "filename": "dubbo-101.md",
@@ -17,14 +17,26 @@
   "__html": "Dubbo基本用法-Dubbo 
Provider配置\nDubbo基本用法\n本章节主要讲述如何配置dubbo,按照配置方式上分,可以分为:XML配置,properties方式配置,注解方式配置,API调用方式配置。\n按照功能角度进行划分,可以分为Dubbo
 Provider和Dubbo Consumer。接下来章节中,分别对dubbo provider和Dubbo 
consumer进行讲解。\nDubbo Provider配置\nProvider 
配置详解\n配置Dubbo 
Provider有4种方式:XML配置,properties方式配置,API调用方式配置,注解方式配置。\nXML配置\n最简单的配置的样例:\n?xml
 version=1.0 encoding=UTF-8?\nbeans xmlns [...]
 },
 {
+  "filename": "dubbo-generic-invoke.md",
+  "__html": 
"Dubbo的泛化调用\n以下几种场景可以考虑使用泛化调用:\n\n服务测试平台\nAPI 
服务网关\n\n泛化调用主要用于消费端没有 API 接口的情况;不需要引入接口 jar 包,而是直接通过 
GenericService 接口来发起服务调用,参数及返回值中的所有 POJO 均用 Map 
表示。泛化调用对于服务端无需关注,按正常服务进行暴露即可。\n下面来看看消费端如何使用泛化调用进行服务调用。\n通过 
Spring XML 配置进行泛化调用\n在 Spring 配置申明 
generic=true,如:\ndubbo:referenceDubbo 关于同步/异步调用的几种方式\n我们知道,Dubbo 
缺省协议采用单一长连接,底层实现是 Netty 的 NIO 异步通讯机制;基于这种机制,Dubbo 
实现了以下几种调用方式:\n\n同步调用\n异步调用\n参数回调\n事件通知\n\n同步调用\n同步调用是一种阻塞式的调用方式,即
 Consumer 端代码一直阻塞等待,直到 Provider 
端返回为止;\n通常,一个典型的同步调用过程如下:\n\nConsumer 业务线程调用远程接口,向 Provider 
发送请求,同时当前线程处于阻塞状态;\nProvider 接到 Consumer 
的请求后,开始处理请求,将结果返回给 Consumer;\nConsumer 
收到结果后,当前线程继续往后执行。\n\n< [...]
 },
 {
+  "filename": "dubbo-loadbalance.md",
+  "__html": ""
+},
+{
   "filename": "dubbo-meetup-shanghai-jun-23rd-2018.md",
   "__html": 

[incubator-dubbo-website] branch asf-site updated: add blogs (#87)

2018-08-10 Thread jerrick
This is an automated email from the ASF dual-hosted git repository.

jerrick pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 26eadb1  add blogs (#87)
26eadb1 is described below

commit 26eadb158488a435e8af9ca2998313a1c0234f03
Author: Jerrick Zhu 
AuthorDate: Fri Aug 10 16:14:53 2018 +0800

add blogs (#87)
---
 blog/zh-cn/dubbo-generic-invoke.md | 172 +
 blog/zh-cn/dubbo-loadbalance.md|   0
 blog/zh-cn/dubbo-new-async.md  |   0
 site_config/blog.js|  23 -
 4 files changed, 194 insertions(+), 1 deletion(-)

diff --git a/blog/zh-cn/dubbo-generic-invoke.md 
b/blog/zh-cn/dubbo-generic-invoke.md
new file mode 100644
index 000..c170c9b
--- /dev/null
+++ b/blog/zh-cn/dubbo-generic-invoke.md
@@ -0,0 +1,172 @@
+# Dubbo的泛化调用
+
+以下几种场景可以考虑使用泛化调用:
+
+- 服务测试平台
+- API 服务网关
+
+泛化调用主要用于消费端没有 API 接口的情况;不需要引入接口 jar 包,而是直接通过 GenericService 
接口来发起服务调用,参数及返回值中的所有 POJO 均用 `Map` 表示。泛化调用对于服务端无需关注,按正常服务进行暴露即可。
+
+下面来看看消费端如何使用泛化调用进行服务调用。
+
+ 通过 Spring XML 配置进行泛化调用
+
+在 Spring 配置申明 `generic="true"`,如:
+
+```xml
+
+```
+
+需要使用的地方,通过强制类型转化为 GenericService 进行调用:
+
+```java
+GenericService userService = (GenericService) context.getBean("userService");
+// primary param and return value
+String name = (String) userService.$invoke("delete", new 
String[]{int.class.getName()}, new Object[]{1});
+System.out.println(name);
+```
+
+其中:
+
+1. GenericService 这个接口只有一个方法,名为 `$invoke`,它接受三个参数,分别为方法名、方法参数类型数组和参数值数组;
+2. 对于方法参数类型数组
+   1. 如果是基本类型,如 int 或 long,可以使用 `int.class.getName()`获取其类型;
+   2. 如果是基本类型数组,如 int[],则可以使用 `int[].class.getName()`;
+   3. 如果是 POJO,则直接使用全类名,如 `com.alibaba.dubbo.samples.generic.api.Params`。
+
+ 通过 API 编程进行泛化调用
+
+```
+ApplicationConfig application = new ApplicationConfig()ApplicationConfig 
application = new ApplicationConfig();
+application.setName("api-generic-consumer");
+
+RegistryConfig registry = new RegistryConfig();
+registry.setAddress("zookeeper://127.0.0.1:2181");
+
+application.setRegistry(registry);
+
+ReferenceConfig reference = new 
ReferenceConfig();
+// 弱类型接口名
+reference.setInterface("com.alibaba.dubbo.samples.generic.api.IUserService");
+// 声明为泛化接口
+reference.setGeneric(true);
+
+reference.setApplication(application);
+
+// 用com.alibaba.dubbo.rpc.service.GenericService可以替代所有接口引用
+GenericService genericService = reference.get();
+
+String name = (String) genericService.$invoke("delete", new 
String[]{int.class.getName()}, new Object[]{1});
+System.out.println(name);
+```
+
+通过 API 的方式,不需要像 XML 的方式需要提前将服务配置好,可以动态构建 ReferenceConfig;相对 XML 来说,API 的方式更常见。
+
+ 参数或返回值是 POJO 的场景
+
+比如方法签名是 `User get(Params params);`其中 User 有 id 和 name 两个属性,Params 有 query 一个属性。
+
+以下是消费端的调用代码:
+
+```java
+String[] parameterTypes = new 
String[]{"com.alibaba.dubbo.samples.generic.api.Params"};
+Map params = new HashMap();
+param.put("class", "com.alibaba.dubbo.samples.generic.api.Params");
+param.put("query", "a=b");
+Object user = userService.$invoke("get", parameterTypes, new Object[]{param});
+System.out.println("sample one result: " + user);
+```
+
+上述代码的输出结果为:
+
+```shell
+sample one result: {name=charles, id=1, 
class=com.alibaba.dubbo.samples.generic.api.User}
+```
+
+这里,Dubbo 框架会自动将 POJO 的返回值转换成 Map。可以看到,返回值 `user` 是一个 HashMap,里面分别存放了 
name、id、class 三个 k/v。
+
+ 泛接口实现
+
+泛接口实现方式主要用于服务端没有 API 接口的情况,参数及返回值中的所有 POJO 均用 Map 表示,通常用于框架集成,如实现一个通用的远程服务 
Mock 框架,可通过实现 GenericService 接口处理所有服务请求。
+
+# 服务端实现 GenericService
+
+```java
+public class GenericServiceImpl implements GenericService {
+@Override
+public Object $invoke(String method, String[] parameterTypes, Object[] 
args) throws GenericException {
+if (method.equals("hi")) {
+return "hi, " + args[0];
+} else if (method.equals("hello")) {
+return "hello, " + args[0];
+}
+
+return "welcome";
+}
+}
+```
+
+# 服务端暴露服务
+
+```java
+ApplicationConfig application = new ApplicationConfig();
+application.setName("api-generic-provider");
+
+RegistryConfig registry = new RegistryConfig();
+registry.setAddress("zookeeper://127.0.0.1:2181");
+
+application.setRegistry(registry);
+
+GenericService genericService = new GenericServiceImpl();
+
+ServiceConfig service = new ServiceConfig();
+service.setApplication(application);
+service.setInterface("com.alibaba.dubbo.samples.generic.api.HelloService");
+service.setRef(genericService);
+service.export();
+
+ServiceConfig service2 = new ServiceConfig();
+service2.setApplication(application);
+service2.setInterface("com.alibaba.dubbo.samples.generic.api.HiService");
+service2.setRef(genericService);
+service2.export();
+```
+
+同样,也可以使用 XML 配置的方式暴露服务;此时服务端是没有依赖 HiService 和 HelloService 这两个接口的。
+
+# 消费端进行服务调用
+
+```java
+ApplicationConfig application = new ApplicationConfig();
+application.setName("api-generic-consumer");
+

[incubator-dubbo-website] branch asf-site updated: Update Prepare-an-Apache-release.md

2018-08-10 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 0dff92c  Update Prepare-an-Apache-release.md
0dff92c is described below

commit 0dff92cd49de4804e19689ee735338145e8d422a
Author: ken.lj 
AuthorDate: Fri Aug 10 15:55:32 2018 +0800

Update Prepare-an-Apache-release.md
---
 blog/zh-cn/Prepare-an-Apache-release.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blog/zh-cn/Prepare-an-Apache-release.md 
b/blog/zh-cn/Prepare-an-Apache-release.md
index 28ffee3..e6223fb 100644
--- a/blog/zh-cn/Prepare-an-Apache-release.md
+++ b/blog/zh-cn/Prepare-an-Apache-release.md
@@ -285,7 +285,7 @@ Thanks,
 The Apache Dubbo (Incubating) Team
 ```
 
-##正式发布
+## 正式发布
 
 1. 
提交https://dist.apache.org/repos/dist/dev/incubator/dubbo目录下的发布包到https://dist.apache.org/repos/dist/release/incubator/dubbo/,完成正式发布。
 2. 发邮件到d...@dubbo.apache.org和gene...@apache.org,通知社区发布完成。
@@ -294,4 +294,4 @@ The Apache Dubbo (Incubating) Team
 
 **apache.repository.org 
nexus仓库的权限已经申请,参见[jira](https://issues.apache.org/jira/browse/INFRA-16451)。**
 
-之前发布到maven仓库的atifacts都处于staging状态,用Apache id登录apache.repository.org,发布即可。
\ No newline at end of file
+之前发布到maven仓库的atifacts都处于staging状态,用Apache id登录apache.repository.org,发布即可。



[incubator-dubbo-docs] branch master updated (997d0c2 -> 4687ecf)

2018-08-10 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-docs.git.


from 997d0c2  Minor corrections to user guide (#35)
 add 8b8a7a7  fix invalid link
 new 4687ecf  Merge pull request #40 from nzomkxia/link-fix

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dubbo-admin-book-en/install/redis.md  | 4 ++--
 dubbo-admin-book-en/install/simple-monitor-center.md  | 2 +-
 dubbo-admin-book-en/install/simple-registry-center.md | 2 +-
 dubbo-admin-book/install/redis.md | 4 ++--
 dubbo-admin-book/install/simple-monitor-center.md | 2 +-
 dubbo-admin-book/install/simple-registry-center.md| 2 +-
 dubbo-user-book-en/demos/callback-parameter.md| 2 +-
 dubbo-user-book-en/demos/fault-tolerent-strategy.md   | 2 +-
 dubbo-user-book-en/demos/group-merger.md  | 4 ++--
 dubbo-user-book-en/demos/loadbalance.md   | 2 +-
 dubbo-user-book-en/demos/multi-registry.md| 2 +-
 dubbo-user-book-en/demos/parameter-validation.md  | 4 ++--
 dubbo-user-book-en/demos/result-cache.md  | 4 ++--
 dubbo-user-book-en/demos/routing-rule.md  | 2 +-
 dubbo-user-book-en/demos/service-container.md | 2 +-
 dubbo-user-book-en/quick-start.md | 4 ++--
 dubbo-user-book-en/references/protocol/thrift.md  | 2 +-
 dubbo-user-book-en/references/registry/redis.md   | 2 +-
 dubbo-user-book-en/references/registry/zookeeper.md   | 2 +-
 dubbo-user-book-en/references/telnet.md   | 4 ++--
 dubbo-user-book/demos/callback-parameter.md   | 2 +-
 dubbo-user-book/demos/fault-tolerent-strategy.md  | 2 +-
 dubbo-user-book/demos/group-merger.md | 4 ++--
 dubbo-user-book/demos/loadbalance.md  | 2 +-
 dubbo-user-book/demos/multi-registry.md   | 2 +-
 dubbo-user-book/demos/parameter-validation.md | 4 ++--
 dubbo-user-book/demos/result-cache.md | 4 ++--
 dubbo-user-book/demos/routing-rule.md | 2 +-
 dubbo-user-book/demos/service-container.md| 2 +-
 dubbo-user-book/quick-start.md| 4 ++--
 dubbo-user-book/references/protocol/thrift.md | 2 +-
 dubbo-user-book/references/registry/redis.md  | 2 +-
 dubbo-user-book/references/registry/zookeeper.md  | 2 +-
 dubbo-user-book/references/telnet.md  | 4 ++--
 34 files changed, 46 insertions(+), 46 deletions(-)



[incubator-dubbo-docs] 01/01: Merge pull request #40 from nzomkxia/link-fix

2018-08-10 Thread iluo
This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-docs.git

commit 4687ecfc1e5918aa9d8b5753285e7b344b840fed
Merge: 997d0c2 8b8a7a7
Author: Ian Luo 
AuthorDate: Fri Aug 10 15:09:27 2018 +0800

Merge pull request #40 from nzomkxia/link-fix

fix invalid link

 dubbo-admin-book-en/install/redis.md  | 4 ++--
 dubbo-admin-book-en/install/simple-monitor-center.md  | 2 +-
 dubbo-admin-book-en/install/simple-registry-center.md | 2 +-
 dubbo-admin-book/install/redis.md | 4 ++--
 dubbo-admin-book/install/simple-monitor-center.md | 2 +-
 dubbo-admin-book/install/simple-registry-center.md| 2 +-
 dubbo-user-book-en/demos/callback-parameter.md| 2 +-
 dubbo-user-book-en/demos/fault-tolerent-strategy.md   | 2 +-
 dubbo-user-book-en/demos/group-merger.md  | 4 ++--
 dubbo-user-book-en/demos/loadbalance.md   | 2 +-
 dubbo-user-book-en/demos/multi-registry.md| 2 +-
 dubbo-user-book-en/demos/parameter-validation.md  | 4 ++--
 dubbo-user-book-en/demos/result-cache.md  | 4 ++--
 dubbo-user-book-en/demos/routing-rule.md  | 2 +-
 dubbo-user-book-en/demos/service-container.md | 2 +-
 dubbo-user-book-en/quick-start.md | 4 ++--
 dubbo-user-book-en/references/protocol/thrift.md  | 2 +-
 dubbo-user-book-en/references/registry/redis.md   | 2 +-
 dubbo-user-book-en/references/registry/zookeeper.md   | 2 +-
 dubbo-user-book-en/references/telnet.md   | 4 ++--
 dubbo-user-book/demos/callback-parameter.md   | 2 +-
 dubbo-user-book/demos/fault-tolerent-strategy.md  | 2 +-
 dubbo-user-book/demos/group-merger.md | 4 ++--
 dubbo-user-book/demos/loadbalance.md  | 2 +-
 dubbo-user-book/demos/multi-registry.md   | 2 +-
 dubbo-user-book/demos/parameter-validation.md | 4 ++--
 dubbo-user-book/demos/result-cache.md | 4 ++--
 dubbo-user-book/demos/routing-rule.md | 2 +-
 dubbo-user-book/demos/service-container.md| 2 +-
 dubbo-user-book/quick-start.md| 4 ++--
 dubbo-user-book/references/protocol/thrift.md | 2 +-
 dubbo-user-book/references/registry/redis.md  | 2 +-
 dubbo-user-book/references/registry/zookeeper.md  | 2 +-
 dubbo-user-book/references/telnet.md  | 4 ++--
 34 files changed, 46 insertions(+), 46 deletions(-)