You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/04/20 07:27:03 UTC

[GitHub] ralf0131 closed pull request #20: Correct and optimize the manual of routing rule

ralf0131 closed pull request #20: Correct and optimize the manual of routing rule
URL: https://github.com/apache/incubator-dubbo-docs/pull/20
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-user-book-en/demos/routing-rule.md b/dubbo-user-book-en/demos/routing-rule.md
index 346cbcc..b15fa1e 100644
--- a/dubbo-user-book-en/demos/routing-rule.md
+++ b/dubbo-user-book-en/demos/routing-rule.md
@@ -17,6 +17,8 @@ registry.register(URL.valueOf("condition://0.0.0.0/com.foo.BarService?category=r
 * `condition://` It indicates the type of routing rules, supports routing rules and script routing rules, and can be extended. **Required**。
 * `0.0.0.0` It indicates that all IP addresses are valid. If you want to take effect for only one IP address, fill in the IP address. **Required**。
 * `com.foo.BarService` It indicates that the specified service is effective. **Required**。
+* `group=foo` It indicates that the specified service in specified group is effective. When absent, the specified service which dosen't configure group is effective.
+* `version=1.0`It indicates that the specified service in specified version is effective. When absent, the specified service which dosen't configure version is effective.
 * `category=routers` It indicates that the data is a dynamic configuration type. **Required**。
 * `dynamic=false` It indicates that it is persistent data. When the registrant exits, the data is still stored in the registry. **Required**。
 * `enabled=true` It indicates whether this routing rules is effective. Option, and default effective.
@@ -114,13 +116,13 @@ Script routing rules [^4] support all scripts of JDK script engine. such as: jav
 
 
 ```
-"script://0.0.0.0/com.foo.BarService?category=routers&dynamic=false&rule=" + URL.encode("function route(invokers) { ... } (invokers)")
+"script://0.0.0.0/com.foo.BarService?category=routers&dynamic=false&rule=" + URL.encode("(function route(invokers) { ... } (invokers))")
 ```
 
 Routing rules that base on script engine is as follow:
 
 ```javascript
-function route(invokers) {
+(function route(invokers) {
     var result = new java.util.ArrayList(invokers.size());
     for (i = 0; i < invokers.size(); i ++) {
         if ("10.20.153.10".equals(invokers.get(i).getUrl().getHost())) {
@@ -128,7 +130,7 @@ function route(invokers) {
         }
     }
     return result;
-} (invokers); // Indicates that the method is executed immediately
+} (invokers)); // Indicates that the method is executed immediately
 ```
 
 [^1]: Support since `2.2.0`   
diff --git a/dubbo-user-book/demos/routing-rule.md b/dubbo-user-book/demos/routing-rule.md
index 77a785e..94803e9 100644
--- a/dubbo-user-book/demos/routing-rule.md
+++ b/dubbo-user-book/demos/routing-rule.md
@@ -17,6 +17,8 @@ registry.register(URL.valueOf("condition://0.0.0.0/com.foo.BarService?category=r
 * `condition://` 表示路由规则的类型,支持条件路由规则和脚本路由规则,可扩展,**必填**。
 * `0.0.0.0` 表示对所有 IP 地址生效,如果只想对某个 IP 的生效,请填入具体 IP,**必填**。
 * `com.foo.BarService` 表示只对指定服务生效,**必填**。
+* `group=foo` 对指定服务的指定group生效,不填表示对未配置group的指定服务生效
+* `version=1.0`对指定服务的指定version生效,不填表示对未配置version的指定服务生效
 * `category=routers` 表示该数据为动态配置类型,**必填**。
 * `dynamic=false` 表示该数据为持久数据,当注册方退出时,数据依然保存在注册中心,**必填**。
 * `enabled=true` 覆盖规则是否生效,可不填,缺省生效。
@@ -114,13 +116,13 @@ registry.register(URL.valueOf("condition://0.0.0.0/com.foo.BarService?category=r
 
 
 ```
-"script://0.0.0.0/com.foo.BarService?category=routers&dynamic=false&rule=" + URL.encode("function route(invokers) { ... } (invokers)")
+"script://0.0.0.0/com.foo.BarService?category=routers&dynamic=false&rule=" + URL.encode("(function route(invokers) { ... } (invokers))")
 ```
 
 基于脚本引擎的路由规则,如:
 
 ```javascript
-function route(invokers) {
+(function route(invokers) {
     var result = new java.util.ArrayList(invokers.size());
     for (i = 0; i < invokers.size(); i ++) {
         if ("10.20.153.10".equals(invokers.get(i).getUrl().getHost())) {
@@ -128,7 +130,7 @@ function route(invokers) {
         }
     }
     return result;
-} (invokers); // 表示立即执行方法
+} (invokers)); // 表示立即执行方法
 ```
 
 [^1]: `2.2.0` 以上版本支持


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services