liuyu 5 лет назад
Родитель
Сommit
558862b329
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      app/service/rabbitmq.js

+ 3 - 2
app/service/rabbitmq.js

@@ -1,6 +1,5 @@
 'use strict';
 
-const _ = require('lodash');
 const Service = require('egg').Service;
 
 class RabbitmqService extends Service {
@@ -26,6 +25,8 @@ class RabbitmqService extends Service {
   async receiveQueueMsg(ex, routeKey, receiveCallBack) {
     const self = this;
     const { mq } = self.ctx;
+    console.log(mq);
+    console.log(self.exType);
     if (mq) {
       const ch = await mq.conn.createChannel();
       try {
@@ -34,7 +35,7 @@ class RabbitmqService extends Service {
         console.log('==q=', q);
         // 队列绑定 exchange
         await ch.bindQueue(q.queue, ex, routeKey);
-        await ch.consume(q.queue, msg => {
+        ch.consume(q.queue, msg => {
           console.log('收到消息: ', msg);
           // 发送确认消息
           ch.ack(msg);