title: rabbitmq/java - receive messages by a wish, not by subscribe
body: <p>I write consumer for rabbitmq and need receiving messages not by subscribe. I need get it one, work with it, and after work get next one message. It`s some like </p>
  
  <pre><code>   while(true){
          String message = consumer.getNext();
          .......
     }
  </code></pre>
  
  <p>In google i found many examples what i need with QueueingConsumer like this         </p>
  
  <pre><code>    while (true) {
        QueueingConsumer.Delivery delivery = consumer.nextDelivery();
        String message = new String(delivery.getBody());
  
        System.out.println(" [x] Consumer : received '" + message + "'");
        doWork(message);
  
        channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
      }
  </code></pre>
  
  <p>But QueueingConsumer is deprecated and removed from last rabbitmq java lib. I found only tutorials with subscribe like this <a href="https://www.rabbitmq.com/tutorials/tutorial-one-java.html" rel="nofollow noreferrer">https://www.rabbitmq.com/tutorials/tutorial-one-java.html</a> </p>
  
  <p>Tell please, where cat i find fresh java coode example with functional what i need?</p>