int n = 0;
while (n++ < 100 && messageCount(rabbitAdmin, queueName) == 0) {
Thread.sleep(100);
}
assertTrue("Message count = 0", n < 100);
Channel channel = connectionFactory.createConnection().createChannel(false);
DefaultConsumer consumer = new DefaultConsumer(channel);
channel.basicConsume(queueName, true, consumer);
n = 0;
while (n++ < 100 && messageCount(rabbitAdmin, queueName) > 0) {
Thread.sleep(100);