T
T
tikhonov_alexander2018-07-25 02:30:47
Node.js
tikhonov_alexander, 2018-07-25 02:30:47

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

1 answer(s)
R
RidgeA, 2018-07-25
@RidgeA

rabbitmq is waiting for confirmation of message processing.
You must either confirm (ack) or create a consumer indicating that you do not need to wait for confirmation (noAck)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question