Tuesday 27 June 2017

Do you close your RabbitMQ connections?

Hi allI have a node app (server) which takes traffic data and sends it to a RabbitMQ queue. The traffic data comes from multiple clients, so it's constantly accepting traffic data from clients and sending it over to RabbitMQ.My current code does not ever close the connection:amqp.connect('amqp://user:pass@ip', function(err, conn) { conn.createChannel(function(err, ch) { var q = 'queue'; ch.assertQueue(q, {durable: true}); ch.sendToQueue(q, new Buffer(JSON.stringify(data)), {persistent: true}); }); }); As you can see, at no point is the connection closed.Is this a problem? Is there a better way to handle it?Thank you for your comments.

Submitted June 28, 2017 at 05:35AM by just_tech_stuff

No comments:

Post a Comment