Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
Acknowledge based consume message from rabbitmq in node js

I am trying to consume message from rabbitmq in node js. It's consuming properly. Here I am doing some operation (API call) during consuming message. Now I want to acknowledge once api responded 200 status only . Otherwise message will not deque. How can I do that ? Thanks in advance

let config = {
protocol: 'amqp',
hostname: '10.25.8.5',
username: '****',
password: '******'
};
amqp.connect(config, function(error0, connection) {
if (error0) {
    throw error0;
}
connection.createChannel(function(error1, channel) {
    if (error1) {throw error1;}

    var queue = 'test_queue';

    channel.assertQueue(queue, {
        durable: false
    });

    console.log(" [*] Waiting for messages", queue);

    channel.consume(queue, function(msg) {


        let consumedData = msg.content.toString();

        // Other process by calling api .

        console.log(" [x] Received ", consumedData);

    }, {
        noAck: true
    });
});
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!