dubbo-js

The Typescript implementation of Apache Dubbo. An RPC and microservice framework for Node.js and Web development.

APACHE-2.0 License

Downloads
3.7K
Stars
760
Committers
47

Bot releases are hidden (Show)

dubbo-js - 3.3.0-alpha Latest Release

Published by chickenlj about 1 year ago

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.

Get started here.

dubbo-js - Apache Dubbo-js 4.0.0 released

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.

image

image
image

dubbo-js - Apache dubbo-js v3.0.0-rc6 released

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

dubbo-js - [email protected]

Published by hufeng over 5 years ago

remove dumplicate consumer url @sunchuanleihit commit

bugfix consumer register ignore zkRoot @ruigu commit

Thanks all Contributor。

因为我们,js-for-apache-dubbo才更精彩

dubbo-js - fixed: 在获取dubbo的version顺序

Published by hufeng almost 6 years ago

fixed: 在获取dubbo的version时候,先获取version,在获取default.version,如果没有默认是0.0.0

感谢@lileilei同学

dubbo-js - [email protected]

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

dubbo-js - fixed,zk不限重连

Published by hufeng almost 6 years ago

因为merge代码的失误,导致fixed的bug再次引入抱歉。

dubbo-js - add dubboSetting

Published by hufeng almost 6 years ago

Release 2.3.5

作为的dubbo的comsumer,在调用服务端dubbo provider时,

需要动态的去指定一些细碎的dubbo的参数,比如group, version, retry, timeout之类

我们之前充分使用dubbo2.js中的context和middleware的能力,设计了dubbo-invoker

dubbo-invoker很好的承担了这个述求,但是dubbo-invoker也是可以有更好的发挥空间

  1. 更好的cache,不需要每次调用的时候都去获取group,version等信息

  2. 在zk订阅接口的时候需要创建consumer信息写入zookeeper,这个时候也需要group,version等信息这个时候dubbo-invoker有点心有余而力不足

So,基于上诉两点,我们还是直接设计dubboSetting模块传入dubbo对象

How to use?

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,
});

API

setting.match(predict, {group, version}) // predict support, string, Array, RegExp, Thunk.

dubbo-js - fixed dubbo 多实例 bug

Published by hufeng about 6 years ago

[fixed bug] 当dubbo根据zookeeper不同创建多实例的时候,因为queue和dubbo-agent是单例导致调用失败
详情https://github.com/dubbo/dubbo2.js/issues/46

dubbo-js -

Published by hufeng over 6 years ago

一个小优化
onTrace只追踪dubbo2.js本身调用异常(hessian或者socket异常),而不去追踪业务调用异常。

dubbo-js -

Published by hufeng over 6 years ago

  1. refactor zookeeper.ts and remove _agentMap
  2. dubbo.subscribe({onTrace(msg) => {//...}}) , runtime tracing.
  3. 感谢思元小伙伴pull-request,refactor byte operator.
dubbo-js -

Published by hufeng over 6 years ago

  1. 重构代码
  2. fixed bug
  3. 默认只使用一个socket长连接,支持断开自动重连,未来可能会弱化socket-pool
dubbo-js -

Published by hufeng over 6 years ago

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.可以很好解决我们这个问题。

image

将provider集合起来,然后放入Dubbo中,
image

就可以获取优秀的开发体验

image

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或者单元测试。

dubbo-js -

Published by hufeng over 6 years ago

  1. fixed log
  2. 使用const emum instead of enum, less runtime and more performace
  3. reduce hot function
dubbo-js -

Published by hufeng over 6 years ago

[1] zookeeper parseURL 去除多余的decodeURIComponent
[2] scheduler 的dubboInvoke添加availiable socket worker的检测

dubbo-js -

Published by hufeng over 6 years ago

fixed, 如果匹配不上返回null,不去覆盖。

dubbo-js - release dubbo2.js

Published by hufeng over 6 years ago

fixed typescript types
export Context

dubbo-js - [email protected]

Published by hufeng over 6 years ago

发布npm模块