dubbo
dubbo copied to clipboard
Problem when trying script routing rules example in Chapter 6.33 of Dubbo user manual
When I tried the script routing rules example , the return value of the example script was always the value of "invokers". The example script is as follow:
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())) {
result.add(invokers.get(i));
}
}
return result;
} (invokers); // Indicates that the method is executed immediately
According to the grammar of javascript, the meaning of the example script is :
function route(invokers) { ... } ;
(invokers) // This is a single expression .The return value is always invokers.
instead of
function route(invokers) { ... } ;
route(invokers)
Actually, brackets surrounding the codeblock is simple solution.
(function route(invokers) { ... } (invokers) )
Hi, would you mind send a pull request? The documentation is hosted here: https://github.com/apache/incubator-dubbo-docs
@ralf0131 I have send a pull request #20 in incubator-dubbo-docs.