# node-zookeeper-dubbox

> node connect dubbo by default protocol in zookeeper

Latest version **2.2.1** (published 2017-10-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-zookeeper-dubbox
pnpm add node-zookeeper-dubbox
yarn add node-zookeeper-dubbox
bun add node-zookeeper-dubbox
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2017-10-16 |
| First published | 2017-10-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lsg |
| Maintainers | lisg |
| Keywords | zookeeper, node, dubbo, javascript |

## Links

- npm: https://www.npmjs.com/package/node-zookeeper-dubbox
- Repository: https://github.com/lishengguo/node-zookeeper-dubbo
- Homepage: https://github.com/lishengguo/node-zookeeper-dubbo#readme
- Issues: https://github.com/lishengguo/node-zookeeper-dubbo/issues
- npm.io page: https://npm.io/package/node-zookeeper-dubbox

## Dependencies (2)

- [hessian.js](https://npm.io/package/hessian.js.md) ^2.1.8
- [node-zookeeper-client](https://npm.io/package/node-zookeeper-client.md) 0.2.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.2.1 (latest) — 2017-10-16

## README

# node-zookeeper-dubbo
nodejs通过dubbo默认协议通信


### Usage

```javascript
const nzd=require('node-zookeeper-dubbo');
const app=require('express')();
const opt={
  application:{name:'fxxk'},
  register:'www.cctv.com:2181',
  dubboVer:'2.5.3.6',
  root:'dubbo',
  dependencies:{
    Foo:{
      interface:'com.service.Foo',
      version:'LATEST',
      timeout:6000,
      group:'isis',
      methodSignature: {
        findById = (id) => [ {'$class': 'java.lang.Long', '$': id} ],
        findByName = (name) => (java) => [ java.String(name) ],
      }
    },
    Bar:{
      interface:'com.service.Bar',
      version:'LATEST',
      timeout:6000,
      group:'gcd'
    }
  }  
}
opt.java = require('js-to-java')

const Dubbo=new nzd(opt);

const customerObj = {
  $class: 'com.xxx.XXXDTO',
  $: {
    a: 1,
    b: 'test',
    c: {$class: 'java.lang.Long', $: 123}
  }
};

app.get('/foo',(req,res)=>{
  Dubbo.Foo
    .xxMethod({'$class': 'java.lang.Long', '$': '10000000'},customerObj)
    .then(data=>res.send(data))
    .catch(err=>res.send(err))
})

app.get('/foo/findById',(req,res)=>{
  Dubbo.Foo
    .findById(10000)
    .then(data=>res.send(data))
    .catch(err=>res.send(err))
})

app.listen(9090)



```
### 注意

须等待初始化完毕才能正常使用，标志：**Dubbo service init done**

如果要和1.x版本共存的话试试这个，[niv](https://github.com/scott113341/npm-install-version).

### 参数配置说明
- **application**
  * name - 项目名称，必填
- **register** - zookeeper服务地址，必填
- **dubboVer** - dubbo版本，必填
- **root** - 注册到zookeeper上的根节点名称
- **dependencies** - 依赖的服务集，必填
  * Foo - 自定义名称，这里方便起见用Foo作为事例，必填
    * interface - 服务地址，必填
    * version - 版本号，默认2.5.3.6
    * timeout	-	超时时间，默认6000
    * group	-	分组
    * methodSignature	-	方法签名

可以选择使用  [js-to-java](https://github.com/node-modules/js-to-java)， 能极大提高效率
```javascript
var arg={$class:'int',$:123};
//等同于
var arg=java('int',123);
```


[npm-image]:http://img.shields.io/npm/v/node-zookeeper-dubbo.svg?style=flat-square
[npm-url]:https://npmjs.org/package/node-zookeeper-dubbo?style=flat-square
[downloads-image]:http://img.shields.io/npm/dm/node-zookeeper-dubbo.svg?style=flat-square

---
_Source: https://npm.io/package/node-zookeeper-dubbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
