沈斌
2016-12-23 ee567fd428466945ec8bb290308f3e26287dda63
queue.js
@@ -20,4 +20,16 @@
            //process.exit(0)
        }, 500);
    });
};
module.exports.pushToMQ = function(ex, data) {
    amqp.connect(uri, function(err, conn) {
        conn.createChannel(function(err, ch) {
            ch.assertExchange(ex, 'fanout', { durable: false });
            ch.publish(ex, '', new Buffer(JSON.stringify(data)));
        });
        setTimeout(function() {
            conn.close();
        }, 500);
    });
};