{"id":41489214,"url":"https://github.com/eggjs/egg-ons","last_synced_at":"2026-01-23T18:16:19.340Z","repository":{"id":57107488,"uuid":"106391764","full_name":"eggjs/egg-ons","owner":"eggjs","description":"aliyun ons plugin for egg","archived":false,"fork":false,"pushed_at":"2019-04-09T10:31:03.000Z","size":21,"stargazers_count":18,"open_issues_count":1,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-08T00:33:44.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-10T08:46:55.000Z","updated_at":"2023-04-24T16:07:53.000Z","dependencies_parsed_at":"2022-08-20T17:11:10.660Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-ons","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-ons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-ons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-ons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-ons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-ons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-ons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-ons/sbom","scorecard":{"id":368749,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-ons","commit":"822f75c67674a70979dd9b0cf65c403805b3eb00"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 1/8 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:29:31.144Z","repository_id":57107488,"created_at":"2025-08-18T12:29:31.144Z","updated_at":"2025-08-18T12:29:31.144Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T18:16:18.160Z","updated_at":"2026-01-23T18:16:19.333Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-ons\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-ons.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-ons\n[travis-image]: https://img.shields.io/travis/eggjs/egg-ons.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-ons\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-ons.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-ons?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-ons.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-ons\n[snyk-image]: https://snyk.io/test/npm/egg-ons/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-ons\n[download-image]: https://img.shields.io/npm/dm/egg-ons.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-ons\n\naliyun ons plugin for egg\n\n## Install\n\n```bash\n$ npm i egg-ons --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.ons = {\n  enable: true,\n  package: 'egg-ons',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.default.js\nexports.ons = {\n  default: {\n    accessKey: 'your-accessKey',\n    secretKey: 'your-secretKey',\n    // prod：http://onsaddr-internal.aliyun.com:8080/rocketmq/nsaddr4client-internal\n    // dev： http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet\n    // onsAddr: 'http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet',\n  },\n  sub: [{\n    consumerGroup: 'your-consumer-group',\n    topics: [\n      'your-topic',\n    ],\n  }],\n  pub: [{\n    producerGroup: 'your-producer-group',\n    topics: [\n      'your-topic',\n    ],\n  }],\n};\n```\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n## Example\n\n### Consumer\n\nput your subscription codes under the folder `{app_root}/app/ons` and named as the topic name e.g `TP_NAME.js`\n\n```\n.\n├── app\n│   ├── ons\n│   │   └── TP_NAME.js\n│   ├── public\n│   └── router.js\n├── config\n│   └── config.default.js\n├── package.json\n```\n\nyou should implment a subscriber as blow\n\n```js\n// TP_NAME.js\n'use strict';\n\nclass TestSubscriber {\n  constructor(ctx) {\n    this.ctx = ctx;\n  }\n\n  * subscribe(msg) {\n    yield this.ctx.service.messageService.process(msg);\n  }\n\n  static get subExpression() {\n    return 'TagA';\n  }\n}\n\nmodule.exports = TestSubscriber;\n```\n\nsee [RPC](https://github.com/eggjs/egg/issues/1468) for more detail.\n\n### Producer\n\nusing `app.ons / ctx.ons` to create \u0026 send messages\n\n```js\nconst Message = ctx.ons.Message;\nconst msg = new Message('TP_NAME', // topic\n  'TagA', // tag\n  'Hello ONS !!!' // body\n);\nconst sendResult = yield ctx.ons.send(msg);\n```\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n\n## Secure Keys\n\nping @fengmk2 to give you the access key!\n\n- [ons secure keys](https://sharelock.io/1/AbXLnDfKcK5syo0rNnmIfYFagr-YZ9FdYjsV84rrQ0E.Q7hdg2/gPqxUCvlzQ2Kc6TEodWs3pOngxYpzKOAw-oCAgQZ4ZFZ8UF5HD/78NoP0krmaT7I4Ny_h7t4xhiAY2aLzwYlRwlHEmeEPeD7_6ZOI/J_QxBEFyEtAej_CMTL-5gJJS-dOA3lkyy8n3b7--0rJrSt2Vru/KY4Sdu6rwnsU9VZwAr-G2R_P8XiR4pHoHXuppYYbbcuu1PCQNK/rM8ajQMGMZg_PUqQWxaI6_zq0rr8gnmydeebKY0FBkkRRcDbat/v5eDQH6VrBSAqfMcoMEGWBMBeyFId3ClpO5LI0Bh1QFlvD9VbY/1LYQf3B475RvP5mpOgvdvx4xaCMdzSEXjbfZ6eQbDyT7QdF75S/hqr7u5Mclln66T718GxKCZ7XselJFPzxWyLv9Wos8gFIuNBl59/XhsrYXMf7In_W_qZQ84EvuB38CD5GubHsboVkuL0p3eOM4Vj3u/qGUQNUXa5CbGwHg1tKzP3E5eJLCiNX5DCTH2np-YDQJ5BOic27/Gy95jKwNTqowGT-n8vOpzn3b2ZIPDBZW2xaSI5NCYrbAMc9lbm/R-Vg751_pFx51fI1C4VoMBC44qgb5auUwtnEbl-DvKDuI2qb6b/-grhrQBp5wMZPBZMi5YfiOGQJxSMhxfGLjTwOJhCnojlcjls1Z/DMEaYzol0xDRdJYG5VwlaKUyIU_iAMfhFU7XZI_T3cqXdI3Pxg/XaCm0n2iJIJMjh0FE.G5xap1BPeUo3wZzXanJa8A#)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-ons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-ons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-ons/lists"}