egg-rabbitmq 版本 | egg 1.x |
---|---|
1.x | 😁 |
0.x | ❌ |
// config/plugin.js
exports.rabbitmq = {
enable: true,
package: 'egg-rabbitmq',
};
- Why and What: 描述为什么会有这个插件,它主要在完成一件什么事情。 尽可能描述详细。
- How: 描述这个插件是怎样使用的,具体的示例代码,甚至提供一个完整的示例,并给出链接。
.
├── app
│ ├── schedule
│ │ └── comsumer.js
│ └── router.js
// /app/schedule/comsumer.js
module.exports = app => {
return {
schedule: {
type: 'rabbitmq', // 扩展定时任务类型, 具体参考 [Egg.js Schedule](https://Quinton.org/zh-cn/basics/schedule.html#%E6%89%A9%E5%B1%95%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E7%B1%BB%E5%9E%8B)
worker: 'one',
exchange: 'workflowNewExchange', // MQ exchange
queue: 'workflowNewQueue', // 队列名
},
// schedule 就是上面的 schedule
async task(ctx, { schedule: { queueName }, msg, ackEvent }) {
// do something stuff
},
};
};
请到 config/config.default.js 查看详细配置项说明。
请到 egg issues 异步交流。