我正在使用@RabbitListener注解和SimpleRabbitListenerContainerFactory bean来并行执行RabbitMQ消息,并通过以下方式设置最小和最大并发消费者:
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory());
factory.setConcurrentConsumers(MIN_RABBIT_CONCURRENT_CONSUMERS);
factory.setMaxConcurrentConsumers(MAX_RABBIT_CONCURRENT_CONSUMERS);
factory.setConsecutiveActiveTrigger(1);
factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
return factory;
}
最小限制为3,最大限制为10。根据这个配置,即使队列中有12条消息,也只会并行执行3条消息。
请告诉我这个配置有什么问题?