title: Manually ack messages in RabbitMQ
body: <p>Previously I was reading all the messages present in the queue, but now I have to return specific amount of message based of users choice(count).</p>
  <p>I try to change the for loop accordingly but its reading all the message because of auto acknowledge. So I tried changing it to manual in config file.</p>
  <p>In my program how to ack message manually after reading msg(currently i am using AmqpTemplate to receive and i don't have reference of channel)?</p>
  <pre><code>    Properties properties = admin.getQueueProperties(&quot;queue_name&quot;);
      if(null != properties)
      {
          Integer messageCount = Integer.parseInt(properties.get(&quot;QUEUE_MESSAGE_COUNT&quot;).toString());          
          while(messageCount &gt; 0)
          {
              Message msg = amqpTemplate.receive(queue_name);
              String value = new String(msg.getBody());
              
              valueList.add(value);
              messageCount--;
          }
  }
  </code></pre>
  <p>Any help is highly appreciable, Thanks in advance.</p>