I use AMQP for my application. I want to close the connection to the consumer AMQP after all the message queues have been received. However, I don't know how to handle it. I will be very grateful and appreciated if someone help me. Thank you
var amqp = require('amqplib');
amqp.connect('amqp://localhost').then(function(conn) {
process.once('SIGINT', function() { conn.close(); });
return conn.createChannel().then(function(ch) {
 var ok = ch.assertQueue('hello', {durable: false});
 ok = ok.then(function(_qok) {
  return ch.consume('hello', function(msg) {
    console.log(" [x] Received '%s'", msg.content.toString());
  }, {noAck: false});
});
return ok.then(function(_consumeOk) {
  console.log(' [*] Waiting for messages. To exit press CTRL+C');
  
 });
 })
 }).catch(console.warn);
				
                        
conn.close()this close function will be close the connection