
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
$ npm i egg-dubbo --save
// {app_root}/config/plugin.js
exports.eggDubbo = {
enable: true,
package: 'egg-dubbo',
};
// {app_root}/config/config.default.js
exports.dubbo = {
// 默认服务版本
version: '2.0.0',
// 默认超时时间
timeout: 6000,
// 服务列表
list: {
// 多服务配置, 例如goods表示商品系统应用的服务
goods: {
applicationName: 'your_application_ame',
register: 'your_zk_service',
dubboVer: '2.5.3'
}
}
};
see config/config.default.js for more detail.

'use strict';
module.exports = (app) => {
/**
* 商品RPC服务
*/
class GoodsRpcService extends app.RpcService {
constructor() {
super(app);
this.channel = 'goods'; // 自定义频道列表
this.interfaceUrl = 'com.xxx.product.goods.rpc.goods.service.RpcGoodsService'; // JAVA服务类
}
// ========= 业务签名 ========
/**
* 注册方法签名
*/
signature() {
this.methodSignature = {
// 依据商品ID获取商品信息
getSimpleGoods: (goodsId) => [{
'$class': 'java.lang.Long',
'$': goodsId
}],
// 依据商品对像查询商品关联列表
selectByPage: (good) => [
{
$class: 'com.xxx.product.goods.rpc.goods.query.RpcGoodsInfoQuery',
$: {
cid: { $class: 'java.lang.Long', $: good.cid },
pageNo: { $class: 'java.lang.Integer', $: good.pageNo },
pageSize: { $class: 'java.lang.Integer', $: good.pageSize }
}
}
]
};
}
// ========= 业务签名 ========
// ======== 业务接口 =========
/**
* 简单传参示例
* @param {*} goodsId
*/
* getSimpleGoods(goodsId) {
const resultData = yield this.request('getSimpleGoods', goodsId);
return resultData;
}
/**
* 复杂传参示例
* @param {*} cid
* @param {*} pageNo
* @param {*} pageSize
*/
* selectByPage(cid, pageNo, pageSize) {
const resultData = yield this.request('selectByPage', {
cid,
pageNo,
pageSize
});
return resultData;
}
// ======== 业务接口 =========
}
// 注册服务
app.goodsService = new GoodsRpcService(app);
app.goodsService.update();
};
/**
* 服务调用示例
* @param {*} goodsId
*/
* getSimpleGoods(goodsId) {
const resultData = yield this.app.goodsService.getSimpleGoods(goodsId);
return resultData;
}

Please open an issue here.
FAQs
egg.js dubbo service proxy middleware
We found that egg-dubbo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.