Gathering detailed insights and metrics for apache-dubbo-js
Gathering detailed insights and metrics for apache-dubbo-js
npm install apache-dubbo-js
Typescript
Module System
Min. Node Version
Node Version
NPM Version
74.4
Supply Chain
95.6
Quality
73.1
Maintenance
25
Vulnerability
99.5
License
3.3.0-alpha
Published on 08 Sept 2023
Apache Dubbo-js 4.0.0 released
Published on 22 Jul 2021
Apache dubbo-js v3.0.0-rc6 released
Published on 16 Jan 2020
dubbo2.js@2.3.9
Published on 29 Apr 2019
fixed: 在获取dubbo的version顺序
Published on 20 Dec 2018
dubbo2.js@2.3.7
Published on 19 Dec 2018
TypeScript (92.44%)
JavaScript (4.69%)
Go (1.57%)
Makefile (0.98%)
CSS (0.14%)
Shell (0.08%)
Java (0.06%)
HTML (0.03%)
Total Downloads
12,275
Last Day
1
Last Week
3
Last Month
15
Last Year
741
767 Stars
903 Commits
161 Forks
117 Watching
8 Branches
124 Contributors
Minified
Minified + Gzipped
Latest Version
3.0.0-rc6
Package Id
apache-dubbo-js@3.0.0-rc6
Unpacked Size
272.99 kB
Size
36.85 kB
File Count
114
NPM Version
6.13.7
Node Version
10.15.3
Cumulative downloads
Total Downloads
Last day
-66.7%
1
Compared to previous day
Last week
-25%
3
Compared to previous week
Last month
7.1%
15
Compared to previous month
Last year
-88.9%
741
Compared to previous year
nodejs 使用原生的 dubbo 协议打通了 dubbo 的 rpc 方法调用 .
1yarn add dubbo-js
1import {Dubbo, java, TDubboCallResult} from 'dubbo'; 2 3//定义dubbo方法类型接口 4//方便代码自动提示 5//如果写的JavaScript忽略 6interface IDemoService { 7 sayHello(name: string): TDubboCallResult<string>; 8 9 echo(): TDubboCallResult<string>; 10 11 test(): TDubboCallResult<void>; 12 13 getUserInfo(): TDubboCallResult<{ 14 status: string; 15 info: {id: number; name: string}; 16 }>; 17} 18 19//创建dubbo对象 20const dubbo = new Dubbo({ 21 application: {name: 'dubbo-js'}, 22 //zookeeper address 23 register: 'localhost:2181', 24 dubboVersion: '2.0.0', 25 interfaces: ['org.apache.dubbo.demo.DemoService'], 26}); 27 28//代理本地对象->dubbo对象 29const demoService = dubbo.proxyService<IDemoService>({ 30 dubboInterface: 'org.apache.dubbo.demo.DemoService', 31 version: '1.0.0', 32 methods: { 33 sayHello(name) { 34 //仅仅做参数hessian化转换 35 return [java.String(name)]; 36 }, 37 38 echo() {}, 39 40 test() {}, 41 42 getUserInfo() { 43 //仅仅做参数hessian化转换 44 return [ 45 java.combine('com.alibaba.dubbo.demo.UserRequest', { 46 id: 1, 47 name: 'nodejs', 48 email: 'node@qianmi.com', 49 }), 50 ]; 51 }, 52 }, 53}); 54 55const result1 = await demoService.sayHello('node'); 56//print {err: null, res:'hello node from dubbo service'} 57const res = await demoService.echo(); 58//print {err: null, res: 'pang'} 59 60const res = await demoService.getUserInfo(); 61//status: 'ok', info: { id: '1', name: 'test' }
1brew install zookeeper 2brew services start zookeeper 3 4#运行java/dubbo-simple下面的例子 5 6yarn run test 7 8# 全链路日志跟踪 9DEBUG=dubbo*
创建 Dubbo 对象
1const dubbo = new Dubbo({ 2 dubboVersion //当前dubbo的版本 (string类型); 必传 3 application //记录应用的名称,zookeeper的调用时候写入consumer 类型:({name: string};) 可选 4 enableHeartBeat //是否启用心跳机制 默认true 可选 类型 boolean 5 dubboInvokeTimeout //设置dubbo调用超时时间默认10s 可选 类型number 6 dubboSocketPool //设置dubbo创建socket的pool大小,默认4 可选 类型number 7 logger //设置logger对象,可选 8 register //设置zookeeper注册中心地址 必填 类型string 9 zkRoot //zk的默认根路径,默认/dubbo 类型string 10 interfaces //设置zk监听的接口名称 类型 Array<string> 必填 11}); 12 13// Or 14const dubbo = Dubbo.from({ 15 dubboVersion //当前dubbo的版本 (string类型); 必传 16 application //记录应用的名称,zookeeper的调用时候写入consumer 类型:({name: string};) 可选 17 enableHeartBeat //是否启用心跳机制 默认true 可选 类型 boolean 18 dubboInvokeTimeout //设置dubbo调用超时时间默认10s 可选 类型number 19 dubboSocketPool //设置dubbo创建socket的pool大小,默认4 可选 类型number 20 logger //设置logger对象,可选 21 register //设置zookeeper注册中心地址 必填 类型string 22 zkRoot //zk的默认根路径,默认/dubbo 类型string 23 interfaces //设置zk监听的接口名称 类型 Array<string> 必填 24}) 25 26//dubbo的代理服务 27const demoSerivce = Dubbo.proxService({ 28 //代理的服务接口 - string 必传 29 dubboInterface: 'com.alibaba.dubbo.demo.DemoService', 30 //服务接口的版本 - string 必传 31 version: '1.0.0', 32 //接口内的方法 - Array<Function> 必传 33 methods: { 34 //method name 35 xx(params) { 36 return [ 37 params 38 ] 39 } 40 }, 41})
1import {Dubbo} from 'dubbo-js';
默认导入的 dubbo-js 是按照 es2017 进行编译的,支持 node7.10 以上。
如果更低的 node 版本,可以使用
1import {Dubbo} from 'dubbo-js/es6';
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More