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