node-zookeeper-dubbo-qk

1.0.4 • Public • Published

node-zookeeper-dubbo-qk

此项目用于node服务连接zookeeper,通过zookeeper分配的服务器信息,连接java的dubbo服务通过hession协议进行高效的数据通信。

nodejs connect dubbo by default protocol in zookeeper

Modified on the basis of node-zookeeper-dubbo

config

env

dubbo service version

conn

zookeeper conn url

path

the service you need

version

dubbo version

Example

var Service=require('node-zookeeper-dubbo-qk');
 
var opt={
  env:'test', // dubbo service version
  gruop:'dubbo', // dubbo group default by 'dubbo',optional
  conn:'127.0.0.1:2180', // zookeeper url
  path:'com.customer.Service', // service url
  version:'2.3.4.5' // dubbo version
}
 
var method="getUserByID";
var arg1={$class:'int',$:123}
var args=[arg1];
 
var service = new Service(opt);
service.excute(method,args,function(err,data){
  if(err){
    console.log(err);
    return;
  }
  console.log(data)
})
 
or
 
service
  .excute(method,args)
  .then(function(data){
    console.log(data);
  })
  .catch(function(err) {
    console.log(err);
  })
 

you can use js-to-java

var arg1={$class:'int',$:123};
//equivalent
var arg1=java('int',123);

Package Sidebar

Install

npm i node-zookeeper-dubbo-qk

Weekly Downloads

1

Version

1.0.4

License

ISC

Last publish

Collaborators

  • iter