title: How to receive single message from the queue in RabbitMQ using C#
body: <p>I would like to know how I can receive only one message at a time
  this is basic code for that</p>
  
  <pre><code>var factory = new ConnectionFactory() { HostName = "localhost" };
  var connection = factory.CreateConnection()
  var channel = connection.CreateModel()
  channel.QueueDeclare("hello", false, false, false, null);
  var consumer = new QueueingBasicConsumer(channel);
  channel.BasicConsume("hello", true, consumer);
  
  BasicDeliverEventArgs ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
  var body = ea.Body;
  var message = Encoding.UTF8.GetString(body);
  Response.Write(message + " Received.");
  </code></pre>