@Override protected boolean process() throws IOException, InterruptedException { channelConnect(); final QueueingConsumer consumer = consumerHolder.get(); if (consumer == null) { // When the channel is not connected, this can happen. Simulate a tick. LOG.warn("Channel not connected!"); Thread.sleep(tickTimeout); return true; } else { final QueueingConsumer.Delivery delivery = consumer.nextDelivery(tickTimeout); if (delivery != null) { try { return consumerCallback.withDelivery(delivery); } finally { final Channel channel = getChannel(); channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } } else { LOG.trace("Tick..."); } return true; } } }