node-zookeeper-dobbo插件
github地址:https://github.com/p412726700/node-zookeeper-dubbo
使用
npm install --save node-zookeeper-dubbo
npm install --save express
const nzd=require('node-zookeeper-dubbo'); const app=require('express')(); const opt={ application:{name:'fxxk'}, //项目名称 register:'www.cctv.com:2181', //zookeeper连接字符串 dubboVer:'2.5.3.6', //dubbo版本 root:'dubbo', //注册到zk上的根节点,默认为dubbo dependencies:{ //依赖的服务列表 Foo:{interface:'com.service.Foo',version:'LATEST',timeout:6000,group:'isis'}, Bar:{interface:'com.service.Bar',version:'LATEST',timeout:6000,group:'gcd'} } } 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的参数列表: //参数1:{'$class': 'java.lang.Long', '$': 10000000},long型,值为10000000; //参数2:customerObj,com.xxx.XXXDTO型 .xxMethod({'$class': 'java.lang.Long', '$': 10000000},customerObj) .then(data=>res.send(data)) .catch(err=>res.send(err)) }) app.listen(9090)