🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

dubbo-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dubbo-client

the node module of dubbo client

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
7
-41.67%
Maintainers
1
Weekly downloads
 
Created
Source

如何安装

Node.js.

NPM

npm install dubbo-client

基于,修复了一些问题

https://github.com/QianmiOpen/dubbo-client

协议

  • jsonrpc协议

如何使用

服务提供者

public interface CarProvider {

    boolean add(Car car);

    boolean edit(Car car);

    List<Car> list();
}

消费者

//
var dbc = require('dubbo-client');

//加载配置文件
dbc.config(require('./example/config.js'));

//获取serivce
var version = '1.0.0';
var group = '';
var carService = dbc.getService('me.eeve.service.car.CarProvider', version, group);

//调用方式一, 这种可以立即调用, 无需延迟
carService.call('add', {
    name: '奔驰',
    color: '红色'
})
    .then(function(result){ //成功
        return this.call('list');
    })
    .catch(function(error){ //失败
    })
    .finally(function(){ //不管成功还是失败
    });

//调用方式二, 这种需要延迟, 因为provider的方法是由zookeeper的节点提供,
//所以要先查到这个provider的节点, 这个步骤是异步的, 就导致你如果直接调用方法会报错
carService.list();

//当然如果你是在Express里面调用, 那肯定没有问题.
function doFoo(req, res){
    carService.list()
        .then(function(out){
            res.send(out);
        });
}

FAQs

Package last updated on 15 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts