container.setConcurrentConsumers(1);
waitForNConsumers(container, 1);
container.setMaxConcurrentConsumers(3);
RabbitTemplate template = new RabbitTemplate(singleConnectionFactory);
for (int i = 0; i < 20; i++) {
template.convertAndSend("foo", "foo");
}
waitForNConsumers(container, 2); // increased consumers due to work
waitForNConsumers(container, 1, 20000); // should stop the extra consumer after 10 seconds idle
container.setConcurrentConsumers(3);
waitForNConsumers(container, 3);