title: Javascript RabbitMQ -> Pull Single Message
body: <p>I'm trying to pull a single message off of rabbitmq, process it, and acknowledge that single message. I don't want it to continue after acknowledgement pulling messages off the queue. If I don't do ch.close() in the code below, it continues to pull messages after acknowledging the previous message.</p>
  
  <p>Using a docker RabbitMQ instance I've set up this code (which works) but I'm curious if open/closing channels quickly are the best way to do this:</p>
  
  <pre><code>amqp.connect('amqp://guest:guest@localhost', (err, conn) =&gt; {
   conn.createChannel((err, ch) =&gt; {
    if (err) {
     console.error(err);
    } else {
     let q = 'my queue';
     ch.prefetch(1);
     ch.consume(q, data =&gt; {
      console.log(data.content.toString());
      ch.ack(data);
      ch.close();
      returnData = data;
     });
    }
   });
  });
  </code></pre>