Gathering detailed insights and metrics for dubbo
Gathering detailed insights and metrics for dubbo
npm install dubbo
Typescript
Module System
Min. Node Version
Node Version
NPM Version
70.2
Supply Chain
95.1
Quality
73.5
Maintenance
25
Vulnerability
100
License
JavaScript (86.79%)
Shell (13.21%)
Total Downloads
3,609
Last Day
4
Last Week
11
Last Month
41
Last Year
286
25 Stars
21 Commits
5 Forks
5 Watching
1 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
1.1.2
Package Id
dubbo@1.1.2
Unpacked Size
24.45 kB
Size
7.90 kB
File Count
10
NPM Version
6.2.0
Node Version
10.9.0
Cumulative downloads
Total Downloads
Last day
0%
4
Compared to previous day
Last week
10%
11
Compared to previous week
Last month
78.3%
41
Compared to previous month
Last year
3.6%
286
Compared to previous year
node.js dubbo/dubbox client with zookeeper support via dubbo default hessian protocol.
想到这个项目基本上只给国人用,就破例稍微接地气一点,下面都写中文文档
1$ npm install dubbo --save
1import Dubbo from 'dubbo' 2 3const dubbo = new Dubbo({ 4 application: 'my-application-name', 5 6 // Dubbo 父节点名 7 root: 'dubbo-test', 8 9 // Dubbo 的版本 10 version: '2.8.4', 11 zookeeper: { 12 host : '10.0.0.100:2181', 13 14 // node-zookeeper-client 的 createClient 方法的 options, 15 sessionTimeout: 30000, 16 spinDelay : 1000, 17 retries : 5 18 }, 19 20 // 需要注册的服务名,还可以使用 `dubbo.register` 方法来动态注册一个服务 21 services: { 22 member: { 23 interface: 'me.kael.service.memberService', 24 timeout: 6000, 25 group, 26 version 27 } 28 }, 29 30 // 1. Object 31 // 对于每一个 service,长连接池的大小 32 // 这些参数会被直接传递给 generic-pool 33 // 2. false 34 // 若不希望使用连接池,则传递 false 35 pool: { 36 max: 200, 37 min: 10, 38 maxWaitingClients: 500 39 } 40}) 41 42 43// 如果一个服务没有注册就被调用,那么会收到一个 Promise.reject 44dubbo.service('member') 45 46// `'login'` 为方法名 47// invoke 方法可以接多个参数 48.invoke('login', { 49 $class: 'me.kael.member.dto.loginDTO', 50 $: { 51 mobile: { 52 $class: 'java.lang.String', 53 $: '18800008888' 54 }, 55 password: { 56 $class: 'java.lang.String', 57 $: 'my-password' 58 } 59 } 60}) 61.then(isSuccess => { 62 console.log('is successful', isSuccess) 63}) 64 65 66// 动态注册一个服务 67dubbo.register('order', { 68 interface: 'me.kael.service.orderService' 69}) 70.service('order') 71.invoke('create', ...) 72.then(...)
创建一个 Dubbo
实例
options Object
String
当前应用的名称String
dubbo 的父节点名String
连接的 dubbo 服务使用的 dubbo 版本Object
String
zookeeper 的地址,格式为 <ip>[:<port>]
,若端口没有定义,则默认端口为 2181
node-zookeeper-client
的参数,会直接传递Object.<name:ServiceOptions>
需要预先注册的 servicesObject|false
连接池的 options,它会直接作为参数传递给 generic-pool
ServiceOptions Object
注册一个 dubbo service,一个被注册过的 service,可以立即调用它的 service.invoke()
方法,dubbo
与 service 进行 providers 和 consumers 的握手的过程,会被 service 内部的队列处理好。
String
ServiceOptions
Returns this
获取一个 service,即使一个名为 name
的 service,没有被注册过,该方法也会返回一个 Service
实例。
但是若一个 service 没有被注册过,那么在调动 service.invoke()
方法的时候,会得到一个 Promise.reject()
Returns Service
1// 若 `member` service 没有注册,仍然能够获取一个 member 实例 2const member = dubbo.service('member') 3 4member.invoke('login', arg).catch(err => { 5 // 但是当调用 invoke 的时候,会得到一个 `SERVICE_NOT_REGISTERED` 的错误 6 console.log(err.code === 'SERVICE_NOT_REGISTERED') 7 // true 8}) 9 10// 然后,我们若注册了 member 这个 service 11dubbo.register('member', { 12 interface: '...', 13 ... 14}) 15 16// 就可以使用这个 service 了 17member.invoke('login', arg) 18.then(isSuccess => { 19 console.log('is successfull:', isSuccess) 20})
请求一个 service 方法。
String
service 中的方法名,若该方法名不存在,则会得到一个 Promise.reject
any
方法的参数,可传递多个,这里的方法,需要是 java 风格的对象。可以手动拼,或者使用 js-to-java
module.1service.invoke('createProduct', product1, product2)
Returns Promise
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/20 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
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