From b5b999614dad2d58d85a663b4c29e0265a790c6b Mon Sep 17 00:00:00 2001 From: 沈斌 <bluelazysb@hotmail.com> Date: Thu, 15 Dec 2016 12:44:27 +0800 Subject: [PATCH] 暂停保存原始数据 --- queue.js | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/queue.js b/queue.js index 0d55a18..791837d 100644 --- a/queue.js +++ b/queue.js @@ -15,6 +15,37 @@ var message = '{"data": "' + data + '", "time":"' + moment().format('YYYY-MM-DD HH:mm:ss') + '"}'; ch.publish(ex, '', new Buffer(message)); }); - setTimeout(function() { conn.close(); process.exit(0) }, 500); + setTimeout(function() { + conn.close(); + //process.exit(0) + }, 500); + }); +}; + +module.exports.pushToScreen = function(data) { + amqp.connect(uri, function(err, conn) { + conn.createChannel(function(err, ch) { + ch.assertExchange('ex_data_screen', 'fanout', { durable: false }); + var message = { + mac: data.mac, + address: "���������������������������������", + location: { + lat:31.430616, + lng:120.988327 + }, + data: { + x1: data.x1, + x2: data.x2, + x3: data.x3, + x4: data.x4, + x5: data.x5, + x6: data.x6 + } + }; + ch.publish('ex_data_screen', '', new Buffer(message)); + }); + setTimeout(function() { + conn.close(); + }, 500); }); }; \ No newline at end of file -- Gitblit v1.8.0