We have and application that produces messages really fast and requires ACK.
This is a silly simulation:
@Bean
public CachingConnectionFactory ccf() {
var ccf = new CachingConnectionFactory("localhost");
ccf.setPublisherConfirmType(CORRELATED);
ccf.setPublisherReturns(true);
return ccf;
}
@Bean
public ApplicationRunner run(RabbitTemplate template) {
return args -> {
for (int i = 1; i < 10001; i++) {
template.convertAndSend("poc", "hey");
if (i % 1000 == 0) {
LOG.info("{}", i);
} }
};
}
This code end up creating and destroying several channels, is there any way to limit the channels that are going to be created concurrently? (blocking or enqueueing)
This is one of the channels that remain cached in the rabbit console: 127.0.0.1:54190 (509).