|
@@ -13,7 +13,11 @@ class HomeController extends Controller {
|
|
async sendmq() {
|
|
async sendmq() {
|
|
const { ctx, app } = this;
|
|
const { ctx, app } = this;
|
|
console.log(msgValue.MsgValues.EXCHANGE_CROP_REG);
|
|
console.log(msgValue.MsgValues.EXCHANGE_CROP_REG);
|
|
- await this.service.rabbitmq.sendQueueMsg(ctx.query.exchange,ctx.query.routekey, new Buffer(JSON.stringify(ctx.query.msg)));
|
|
|
|
|
|
+ await this.service.rabbitmq.sendQueueMsg(ctx.query.exchange,ctx.query.routekey, new Buffer(JSON.stringify(ctx.query.msg)), (data) =>
|
|
|
|
+ {
|
|
|
|
+ console.log(data);
|
|
|
|
+
|
|
|
|
+ });
|
|
ctx.body = '发送成功';
|
|
ctx.body = '发送成功';
|
|
}
|
|
}
|
|
|
|
|
|
@@ -22,6 +26,10 @@ class HomeController extends Controller {
|
|
await this.service.rabbitmq.receiveQueueMsg(ctx.query.exchange,ctx.query.routekey,(msg) =>
|
|
await this.service.rabbitmq.receiveQueueMsg(ctx.query.exchange,ctx.query.routekey,(msg) =>
|
|
{
|
|
{
|
|
console.log(msg);
|
|
console.log(msg);
|
|
|
|
+
|
|
|
|
+ // 插入待办事项到数据库中。
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
ctx.body = "接收成功";
|
|
ctx.body = "接收成功";
|
|
}
|
|
}
|