The Typescript implementation of Apache Dubbo. An RPC and microservice framework for Node.js and Web development.
APACHE-2.0 License
Bot releases are hidden (Show)
The first Dubbo3 TypeScript release that provides support of Triple protocol (a fully gRPC compatible and http friendly protocol), which can be used for Node.js and web application development. With dubbo-js, you can easily build applications working on browser and frontend that can communicate with backend services through http-based protocol.
Published by hufeng about 3 years ago
After long-term community feedback and collaboration, and thanks to the efforts of the vivo open source collaboration team, we finally ushered in the release of apache dubbo-js 4.0.0.
dubbo-js 4.0.0 will be a new milestone. We have made major software architecture adjustments and provided full-stack dubbo service capabilities. The dubbo/dj under construction will help the framework code zero development ability by building a cross-language DSL language for dubbo.
Published by hufeng almost 5 years ago
Hello Dubbo/Dubbo-js Community,
I am glad to announce that Apache dubbo-js v3.0.0-rc6 released
Published by hufeng over 5 years ago
Published by hufeng almost 6 years ago
fixed: 在获取dubbo的version时候,先获取version,在获取default.version,如果没有默认是0.0.0
感谢@lileilei同学
Published by hufeng almost 6 years ago
上游dubbo2.6.3增加了provider 到 consumer的attachment,
我们做一个协议上的同步
https://github.com/apache/incubator-dubbo/issues/889
因为attachment目的是为了隐式的传参,所以我们不会把这个值合入正常的返回结果中。
因为我们有很好的middleware的机制,可以很方便的从middleware的上下获取这个attachment参数
const dubbo = new Dubbo({
// todo
});
dubbo.use(async (ctx, next) => {
await next();
console.log(ctx.providerAttachments);
})
enjoy <3
Published by hufeng almost 6 years ago
因为merge代码的失误,导致fixed的bug再次引入抱歉。
Published by hufeng almost 6 years ago
作为的dubbo的comsumer,在调用服务端dubbo provider时,
需要动态的去指定一些细碎的dubbo的参数,比如group, version, retry, timeout之类
我们之前充分使用dubbo2.js中的context和middleware的能力,设计了dubbo-invoker
dubbo-invoker很好的承担了这个述求,但是dubbo-invoker也是可以有更好的发挥空间
更好的cache,不需要每次调用的时候都去获取group,version等信息
在zk订阅接口的时候需要创建consumer信息写入zookeeper,这个时候也需要group,version等信息这个时候dubbo-invoker有点心有余而力不足
So,基于上诉两点,我们还是直接设计dubboSetting模块传入dubbo对象
import {Dubbo, setting} from 'dubbo2.js';
//dubbo-setting
const dubboSetting = setting
.match('com.alibaba.dubbo.demo.BasicTypeProvider', {
version: '2.0.0',
})
.match(
[
'com.alibaba.dubbo.demo.DemoProvider',
'com.alibaba.dubbo.demo.ErrorProvider',
],
{version: '1.0.0'},
);
const dubbo = new Dubbo<typeof service>({
application: {name: '@qianmi/node-dubbo'},
register: 'localhost:2181',
service,
dubboSetting,
});
setting.match(predict, {group, version}) // predict support, string, Array, RegExp, Thunk.
Published by hufeng about 6 years ago
[fixed bug] 当dubbo根据zookeeper不同创建多实例的时候,因为queue和dubbo-agent是单例导致调用失败
详情https://github.com/dubbo/dubbo2.js/issues/46
issue #7
总算找到了解决这个问题的方案,这个问题的难点不是怎么实现,而是typescript怎么去定义暴露服务类型,给出代码的完美提示。这个还真有点难。但是不去解决这个问题,真的代码写的很炸。
import A from 'A',
import B from 'B'
import c from 'C'
import ...
const dubbo = new Dubbo({
interfaces: [
'A',
'B',
'C',
......
]
});
const a = A(dubbo);
const b = B(dubbo);
const c = C(dubbo);
......
//整合egg
app.dubbo = {
a,
b,
c,
......
}
同学们想这个接口规模再提高10x 代码就无法看了,当然代码上有优化的空间,但是痛点就是类型的代码提示,一旦动态就无法精确获得类型提示。
我们的翻译器生成的代码格式基本都是
export xxProvider = (dubbo: Dubbo): XxProvider => dubbo.proxyService({...});
在typescript2.8以后支持了conditional type.可以很好解决我们这个问题。
将provider集合起来,然后放入Dubbo中,
就可以获取优秀的开发体验
enjoy :)
在2.0.4+版本中,我们api不再兼容interfaces参数方式,全面使用service参数。
//注入到dubbo的服务,例如:
const userRequest = (dubbo: Dubbo): IUserRequest => dubbo.proxyService<IUserRequest>({...});
const service = {userRequest};
const dubbo = new Dubbo<typeof service>({
// ....,other parameters
service
});
dubbo.service.userRequest.xxx()
更多细节,请参阅 examples或者单元测试。
Published by hufeng over 6 years ago
fixed typescript types
export Context
Published by hufeng over 6 years ago
发布npm模块