Your IP : 216.73.216.43


Current Path : /home/deltalab/PMS/partner-manager-backend/node_modules/amqplib/examples/tutorials/
Upload File :
Current File : //home/deltalab/PMS/partner-manager-backend/node_modules/amqplib/examples/tutorials/receive.js

#!/usr/bin/env node

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: true});
    });

    return ok.then(function(_consumeOk) {
      console.log(' [*] Waiting for messages. To exit press CTRL+C');
    });
  });
}).catch(console.warn);