Answer the question
In order to leave comments, you need to log in
rabbitmq + nodejs Why is the message not removed from the queue after being received?
// send.js
amqp.connect('amqp://localhost', function(err, conn) {
conn_ = conn;
conn.createChannel(function(err, ch) {
ch_ = ch;
var q = 's1';
ch.assertQueue(q, {durable: false});
ch.sendToQueue(q, new Buffer('Hello World! '+ +new Date()));
});
});
// read.js
amqp.connect('amqp://localhost', function(err, conn) {
conn.createChannel(function(err, ch) {
var q = config.rabbitmq.queue_name;
ch.assertQueue(q, {durable: false});
ch.consume(q, (msg) => {
console.log(msg.content.toString());
});
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question