My consumer listen to a queue. Auto Ack = false. - If I ACK message will be removed from the queue. - And if I did not ACK, RabbitMQ will put the message to queue as expected. My problem is my consumer not CONTINUE TO LISTEN TO THOSE UN-ACKED messages. To verify that, if I put a new message, consumer picked it up.
Following is my code block. Any solution ?
while (true) {
try {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
String response = sendEndpoint(message);
if (!response.equals(ERROR_CODE)) {
channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
}
} catch (InterruptedException ignore) {
continue;
}
}