cds-discover
discover power by cds
Last updated 3 years ago by cavacn .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cds-discover 
SYNC missed versions from official npm registry.

TuRing-CDS

cds-discover

npm install cds-discover --save

去中心化服务集群

Example

const Discover = require('cds-discover');

const discover = new Discover();

disconver
    //本地服务监听端口
    .listen(9004)
    //尝试连接到 discover.cavacn.com 根服务器,当然你也可以是  localhost
    //为什么要这个,因为你肯定需要一个领路人,要不然你无法加入这个圈子
    .tryConnect(9004,'discover.cavacn.com');
discover.on('init',()=>{
    //初始化完成之后
    let serviceName = 'YourServiceName';
    let serviceConfig = 'YourServiceConfig'
    //把service注册到  服务集群中
    discover.addService(serverName,serverConfig);
});

discover.watch('你需要监听的service  , . 通配所有',(method,serviceName,config)=>{
    console.log('watch',method,serviceName,config);
});

Current Tags

  • 0.0.5                                ...           latest (3 years ago)

5 Versions

  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 1
Last Week 1
Last Month 10
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |