node.js - nodejs + amqp silently dies -


i have basic script take amqp messages , forward them socket.io works hours, days, silently stops forwarding amqp messages while continuing emit heartbeats.

logs show when gets broken state, isn't trying emit socket.io messages amqp messages arrive, think problem amqp connection/subscription rather socket.io

i tested manually shutting down , restarting rabbitmq server while script running, , appeared have no issues reconnecting , continuing function should.

var port = 8888,         http = require("http"),         amqp = require("amqp"),         socketio = require("socket.io"),         express = require("express"),         rabbitmq = amqp.createconnection({ host: 'server', reconnect: true }),         app = express(),         server = http.createserver(app),         io = socketio.listen(server);  rabbitmq.on("ready", function () {          console.log("ready");          var queue = rabbitmq.queue("ft-secondary-display", function () {                  queue.bind(rabbitmq.exchange('ft', {type: 'topic'}), "data");                  console.log("bound");                 queue.subscribe(function (message, headers, basicinfo) {                         var data = {'key': basicinfo, 'data': message.data.tostring()};                         io.sockets.emit("message-name", data);                 });         }); });  setinterval(hb, 10000);  function hb(){    io.sockets.emit("message-name", "heartbeat"); } 

this bug in amqp library: https://github.com/postwait/node-amqp/issues/306


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -