Skip to content

Commit

Permalink
Modify readme docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey600 committed Sep 15, 2017
1 parent 89dfc36 commit ceed250
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

language: node_js
sudo: true
node_js:
Expand Down
51 changes: 39 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ to connect Dubbo service by
- Invoke Dubbo service as a Customer.
- Use Zookeeper as the Dubbo Registration Center.
- Only supports the use of the default hessian2 protocol for serialization and deserialization.
- It is not very friendly to support the return value containing an enum type.
- It is not very friendly to support the return value containing an enum type.
- Use [Random LoadBalance](https://dubbo.gitbooks.io/dubbo-user-book/demos/loadbalance.html) to choose Provider.
- Use [generic-pool](https://github.com/coopernurse/node-pool) to manage net.Socket.

## Installation

Expand Down Expand Up @@ -59,7 +61,7 @@ invoker.excute(method, [arg1], function (err, data) {

*Arguments*

* conf {*Object*} - An object to set the instance options. Currently available options are:
* conf {*String|Object*} - A string of host:port pairs like `conn`. Or an object to set the instance options. Currently available options are:

* `dubbo` {*String*} - Dubbo version information.

Expand All @@ -72,6 +74,10 @@ invoker.excute(method, [arg1], function (err, data) {
*Example*

```javascript
// use a string of host:port pairs
var zd = new ZD('localhost:2181,localhost:2182');

// use an object to set the instance options
var zd = new ZD({
conn: 'localhost:2181,localhost:2182',
dubbo: '2.5.3'
Expand Down Expand Up @@ -118,7 +124,7 @@ zd.client.close();

----

#### Invoker getInvoker(path, opt)
#### Invoker getInvoker(path[, opt])

*Arguments*

Expand All @@ -128,6 +134,10 @@ zd.client.close();
* `version` {*String*} - Service version information.
* `timeout` {*Number*} - The timeout (in milliseconds) to excute.

*The following content could reference: [generic-pool](https://github.com/coopernurse/node-pool)*
* `poolMax` {*Number*} - Maximum number of net.Socket to create from pool at any given time. Defaults to 1 .
* `poolMin` {*Number*} - Minimum number of net.Socket to keep in pool at any given time. If this is set >= poolMax, the pool will silently set the min to equal max. Defaults to 0 .

*Example*

```javascript
Expand All @@ -138,15 +148,38 @@ var invoker = zd.getInvoker('com.demo.Service', {

----

## Invoker
### new Invoker(zk[, opt])

Also you can create Invoker instance by URIs of providers directly.

*Arguments*

* zk {*Client|String|Array*} - The ZD instance or the URIs of providers.
* opt {*Object*} - An object to set the instance options. Currently available options are:

* `path` {*String*} - Path of service.
* `dubbo` {*String*} - Dubbo version information.

*The other content is same as the `opt` in `getInvoker(path[, opt])`*

### void excute(method, args, cb)
*Example*

```javascript
var invoker = new ZD.Invoker(
'dubbo://127.0.0.1:20880/com.demo.DemoService?anyhost=true&interface=com.demo.DemoService&methods=sayHello&side=provider',
{ version: '0.0.0' }
);
```

----

#### void excute(method, args[, cb])

*Arguments*

* method {*String*} - Method to excute.
* args {*Array*} - Argument list.
* `[`cb(err, data)`]` {*Function*} - The data is the returned value. When the cb is undefined, the function return a Promise instance.
* cb(err, data) {*Function*} - The data is the returned value. When the cb is undefined, the function return a Promise instance.

*Example*

Expand Down Expand Up @@ -174,12 +207,6 @@ invoker.excute(method, [arg1])

----

## Thanks

Thank
[node-zookeeper-dubbo](https://github.com/p412726700/node-zookeeper-dubbo)
provide reference and thoughts.

## License

Licensed under the
Expand Down
2 changes: 1 addition & 1 deletion lib/codec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Created by feichenxi on 2016/6/24.
* Created by Corey600 on 2016/6/24.
*/

'use strict';
Expand Down
2 changes: 1 addition & 1 deletion lib/status.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Created by feichenxi on 2016/6/23.
* Created by Corey600 on 2016/6/23.
*/

'use strict';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"homepage": "https://github.com/Corey600/zoodubbo#readme",
"dependencies": {
"debug": "~2.2.0",
"generic-pool": "^3.1.7",
"generic-pool": "~3.1.7",
"hessian.js": "~2.1.8",
"node-zookeeper-client": "~0.2.2",
"safe-buffer": "~5.1.1"
Expand Down

0 comments on commit ceed250

Please sign in to comment.