|
@@ -11,21 +11,12 @@ class HomeController extends Controller {
|
|
|
async sendmq() {
|
|
|
const { ctx } = this;
|
|
|
// const msg = { userid: ctx.body.userid, name: ctx.body.name, createtime: ctx.body.createtime, type: ctx.body.type, content: ctx.body.content, remark: ctx.body.remark };
|
|
|
- const msg = { userid: '2', name: 'hh', createtime: '2019-10-25 10:10:10', type: '1', content: '您有一个待办事项', remark: '别忘了' };
|
|
|
const ex = 'schedule';
|
|
|
const routekey = '11';
|
|
|
const parm = { durable: true, headers: { userId: '2', type: '1', name: '哈哈' } };
|
|
|
await this.service.rabbitmq.sendQueueMsg(ex, routekey, 'hhhsss', parm);
|
|
|
this.ctx.body = '发送成功';
|
|
|
}
|
|
|
-
|
|
|
- async receivemq() {
|
|
|
- const { ctx } = this;
|
|
|
- await this.service.rabbitmq.receiveQueueMsg(ctx.query.ex, ctx.query.routekey, msg => {
|
|
|
- console.log(msg);
|
|
|
- });
|
|
|
- ctx.body = '接收成功';
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
module.exports = HomeController;
|