{"_id":"@dengzhaofun/egg-ons","_rev":"3-8c6fd48e4f6ba4eb35b7080c71653ce0","name":"@dengzhaofun/egg-ons","dist-tags":{"latest":"2.2.1"},"versions":{"2.1.0":{"name":"@dengzhaofun/egg-ons","version":"2.1.0","description":"aliyun ons plugin for egg","eggPlugin":{"name":"ons"},"keywords":["egg","eggPlugin","egg-plugin"],"dependencies":{"@types/lodash":"^4.14.136","ali-ons":"^3.6.5","lodash":"^4.17.15"},"devDependencies":{"autod":"^3.0.1","autod-egg":"^1.1.0","egg":"^2.9.1","egg-bin":"^4.7.1","egg-mock":"^3.17.3","eslint":"^5.2.0","eslint-config-egg":"^7.0.0","webstorm-disable-index":"^1.2.0"},"engines":{"node":">=8.0.0"},"scripts":{"test":"npm run lint -- --fix && egg-bin pkgfiles && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"egg-bin pkgfiles --check && npm run lint && npm run cov","pkgfiles":"egg-bin pkgfiles","autod":"autod"},"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-ons.git"},"bugs":{"url":"https://github.com/eggjs/egg/issues"},"homepage":"https://github.com/eggjs/egg-ons#readme","author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","gitHead":"822f75c67674a70979dd9b0cf65c403805b3eb00","_id":"@dengzhaofun/egg-ons@2.1.0","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","_npmUser":{"name":"dengzhaofun","email":"3328638734@qq.com"},"maintainers":[{"name":"dengzhaofun","email":"3328638734@qq.com"}],"dist":{"integrity":"sha512-PC7eU6NtCtmi4+1hxXMrCbmI6rYmEQuRZ0HVKC5w75L8EpWVBe810g3p6c7beEhhg+T2KFDdX986LR85kqO38w==","shasum":"82ccf1491353af1fc6ff581724168aeaa8fac8db","tarball":"https://registry.npmjs.org/@dengzhaofun/egg-ons/-/egg-ons-2.1.0.tgz","fileCount":9,"unpackedSize":13530,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQ6uuCRA9TVsSAnZWagAA6VgP/2OKLgJOC5c4xn8d1MJa\nDaLRWRVN/BBgAeK2q+pgXOASugNZEQNTdEUfgk9RmAtlX0wLIDAp3vLbADru\nbNkbvL+yeceFxb5ZbqQj+PLL2w9YncMM4S16yIehuwPJmMX/usVk7/mY9Jlh\nmzIBUfvVAiVH6Tlkd4qf2epj20PSoDDW/kz2+Zs4tqPLodD03LVdMHakvKwS\ngMNRREOeF0gcscYEtrjYiUWGwXaGWERupLOkskHO4Ch1ilHK8legc6tW/Nnl\nKNHc6yL5cT9aQacMQAcDxvIHkfID36jnrrnYhZi6H7HwUYgryQAaLldOa9TJ\nnL31KAEr4NZMk51IjJxLplg3H4WtcjlcyKn02374imnHDK8CAJx/MdK+RISx\nVrp3TdiLC7XmuPk8ELGbmD5eEbTuDE+8+ITLlA9IOF4JoNF68iVLTVT7vS0B\nzn/Yf2/kCyUH5tg3LbgSKfLI29J+Qyx6LbtKBAgMmvMKMlsS/yG5BGBRmK+q\nQ/1lcQ/j02+ugRqyrJUXaB74Alv7gKsyiCxuK2t3u63OqAdYjuc2t5DvTB+o\nO0e1ym9hKfI+JJYp4mOI6zgW2g3C8p58oRAYmBD+F9AlAZ76imtG+s9P5WUk\nx8thc+UBqpOVbXkDuY7SkWd7K9NIY2BEVy7eZJ1zxV98iDFlUpCh56BhCJCp\nler1\r\n=mcCC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWW9G4QAl/6suNTKnxBk2C9/a+Vpwa7qoVbixv5G4DnwIhALNOv5+X+zw65Xq6vdRlz5XCsrEV3fUwP4oQmsMm2Phe"}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-ons_2.1.0_1564715949863_0.14107334635670732"},"_hasShrinkwrap":false},"2.2.0":{"name":"@dengzhaofun/egg-ons","version":"2.2.0","description":"aliyun ons plugin for egg","eggPlugin":{"name":"ons"},"keywords":["egg","eggPlugin","egg-plugin"],"dependencies":{"@types/lodash":"^4.14.136","ali-ons":"^3.6.5","lodash":"^4.17.15"},"devDependencies":{"autod":"^3.0.1","autod-egg":"^1.1.0","egg":"^2.9.1","egg-bin":"^4.7.1","egg-mock":"^3.17.3","eslint":"^5.2.0","eslint-config-egg":"^7.0.0","webstorm-disable-index":"^1.2.0"},"engines":{"node":">=8.0.0"},"scripts":{"test":"npm run lint -- --fix && egg-bin pkgfiles && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"egg-bin pkgfiles --check && npm run lint && npm run cov","pkgfiles":"egg-bin pkgfiles","autod":"autod"},"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-ons.git"},"bugs":{"url":"https://github.com/eggjs/egg/issues"},"homepage":"https://github.com/eggjs/egg-ons#readme","author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","gitHead":"822f75c67674a70979dd9b0cf65c403805b3eb00","_id":"@dengzhaofun/egg-ons@2.2.0","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","_npmUser":{"name":"dengzhaofun","email":"3328638734@qq.com"},"maintainers":[{"name":"dengzhaofun","email":"3328638734@qq.com"}],"dist":{"integrity":"sha512-3ML5LYzSacNoRBI2ghFlbqcKTJjf3gE01dxv3HhwqpR1EZA/PmyotKQWGJT2S52DVV3bSEazn8W5Mq86M8y6/A==","shasum":"26d56f0b94a8045b8aaaeb060ba489917a557c40","tarball":"https://registry.npmjs.org/@dengzhaofun/egg-ons/-/egg-ons-2.2.0.tgz","fileCount":9,"unpackedSize":13154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdUpbxCRA9TVsSAnZWagAAHa4P/ivSlDV3SebARWG0Ct6+\nH4JMFmiL4XtlqU1xbvZaSK/MpzlVMQb+gWcQq56P482MJqJwSmzWyN0x4RSz\n745GogDsMMxZ1SVXQSE4EKJzxbVD02Aj4RZVKkWEVt4EB5yS8PS21WuGVxny\nUyqAvwiAMxJdDM8F9i2kIaFZLe42s/Y/dLLa65bifi4suRCvjfSzoeLsIEri\nyELIouyTtqE1hTfoJ/wuSYFSj7xDD8qjbUCUCBcOIfWMoXU4lV1mev0fbUVg\nN24BpbR6PLlxY0znlR3DfIVdtxi8AjkTuJnu4OpxcrM8QM2xmTYaLU6RNp7d\nM37WKivjNPWSedhaj9iJZIdOgcJWm3k/suIhzhpdnQ4zS84HjojqYofgy7Q0\n6/EVjoIZL1TCu4BerreK7FQJu/GZJ0fY3OxQxStiW9GBSY07F2IxVpvhsb8F\nDtGEUwfxxWRTwMaTmJwh8Y7P7nUPQvZbatTV7s/OR4BjYaFk4kn+qWUklXSc\n8u0yAUWyxuCHAGGOz313Pjon9LMoxzn8AVtsAiNPT88/Dh1Ctto+OC18vXkN\nXPUA7gDbXalJDRj3DYcye6+crRP39xZcsd2lqRXE5Faag7+M/Rh77Q3ZMU+a\nIesQYWDIuvqj8hm36jkWMqeZVjHmdnviuM/OOum8ADCZGKo9XCnNLofzlri+\nEUYZ\r\n=05+n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+tAlDQGRBpHkCAAWfYbKzHB0ssey82lfCFCKupz2mxgIhANzLX/Xw3Yn7cOJjecSVFb1dMKwo9yl/WIv0d3MX+hzX"}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-ons_2.2.0_1565693680768_0.020971055613985712"},"_hasShrinkwrap":false},"2.2.1":{"name":"@dengzhaofun/egg-ons","version":"2.2.1","description":"aliyun ons plugin for egg","eggPlugin":{"name":"ons"},"keywords":["egg","eggPlugin","egg-plugin"],"dependencies":{"@types/lodash":"^4.14.136","ali-ons":"^3.6.5","lodash":"^4.17.15"},"devDependencies":{"autod":"^3.0.1","autod-egg":"^1.1.0","egg":"^2.9.1","egg-bin":"^4.7.1","egg-mock":"^3.17.3","eslint":"^5.2.0","eslint-config-egg":"^7.0.0","webstorm-disable-index":"^1.2.0"},"engines":{"node":">=8.0.0"},"scripts":{"test":"npm run lint -- --fix && egg-bin pkgfiles && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"egg-bin pkgfiles --check && npm run lint && npm run cov","pkgfiles":"egg-bin pkgfiles","autod":"autod"},"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-ons.git"},"bugs":{"url":"https://github.com/eggjs/egg/issues"},"homepage":"https://github.com/eggjs/egg-ons#readme","author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","gitHead":"662a23575f94d02157f21e982bab4e3d004ee766","_id":"@dengzhaofun/egg-ons@2.2.1","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","_npmUser":{"name":"dengzhaofun","email":"3328638734@qq.com"},"maintainers":[{"name":"dengzhaofun","email":"3328638734@qq.com"}],"dist":{"integrity":"sha512-v7p/7kn2I5vZQEcpOrUeDpQgAyh2O4ctyumAZcgzLyLZl6YM01c+COaESQ3fPxrL6tPAkfUIfVRD/HH1GR3KAw==","shasum":"0acabc5d39ff3d65938f446b6004b3c08686048e","tarball":"https://registry.npmjs.org/@dengzhaofun/egg-ons/-/egg-ons-2.2.1.tgz","fileCount":9,"unpackedSize":13155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdUpjNCRA9TVsSAnZWagAA5xMQAJBeIb95wAeuwi/oLHom\nvVCaLXpNcCoCTPHdv/kNDfa5IK+rbLkmXjKJzj1atFuRNendriPijMfURZc8\n97jxtdOx3j5In382Ir+C3ThBHDa4WvUfc7iTneTZKb3qTFtLrPEg2RgXfFoR\ndafOlRq6tkhX6s8aJgl/p+554yuo90FqaO94OuaTogGnp0RVihKqNFJnZony\nSRzBFLdXvSJVbfJOEd1PuOYAp3Xekzt6MRo14H5U09EizfkIrHUSAF0DCuwM\nzUanNGJzU66WGlPlv9fMVkZHh06ipE9PFJi/RmwbLsBT4LOHJ6fC9Pmn9ygz\ntmagyiSrTgwrkgrji+EunLP8yCPuNJxD/hASmNkKVoGVUXX6qGKPCoZz5SvU\nEfq0wbN74etzmRjcPZ4wthlMuJb7wCUujovg19nvdvt7hAUZT+Oej/LfAxiu\ntIdah1v5FW0fP+uTwskIAMsTjnfWetqR7W6+ouPHs0SMtzXqdMredLLlfSRs\nbNWz/Aj8pFK2BkgmBzaJNFiBt2UEOa0ec6xUJBnXsteIRq3OeQkjhq4RoUCB\nPggGawrMdpSgOw6UH0eOabafo6YDPHSxhx2G408a0dFbZ1pbZZvIyQb2pqOQ\nHL5HFB+UJi2Wtr3e7zXFrjQxU9P4Z0nd/QU9xRIme5xJZC9tboTXUcljrZgd\nVZvh\r\n=DWUl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPVBksg4BuWFft2kqpJ1yl1e6oqq4Dt6Qz4wTxjvv8UQIgID/aD5V2fgt23sOva1GGK8wUqXRWf6DZ59Rtb+s0JYM="}]},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-ons_2.2.1_1565694157298_0.9331492765809601"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-02T03:19:09.654Z","2.1.0":"2019-08-02T03:19:10.077Z","modified":"2022-04-05T03:44:54.818Z","2.2.0":"2019-08-13T10:54:40.954Z","2.2.1":"2019-08-13T11:02:37.404Z"},"maintainers":[{"name":"dengzhaofun","email":"3328638734@qq.com"}],"description":"aliyun ons plugin for egg","homepage":"https://github.com/eggjs/egg-ons#readme","keywords":["egg","eggPlugin","egg-plugin"],"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-ons.git"},"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"bugs":{"url":"https://github.com/eggjs/egg/issues"},"license":"MIT","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 & 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 & 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","readmeFilename":"README.md"}