我正在使用Sprint配置RabbitMQ的PrefetchCount和连续活动触发器参数。
请,您能告诉我这两个参数之间的区别吗?
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerReceiveError(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
int concurrentConsumers = Integer.parseInt(PropertiesLoader.getProperty("queue.receive_error.concurrent-consumers"));
int maxConcurrentConsumers = Integer.parseInt(PropertiesLoader.getProperty("queue.receive_error.max-concurrent-consumers"));
int consecutiveActiveTrigger = Integer.parseInt(PropertiesLoader.getProperty("queue.receive_error.consecutive-active-trigger"));
int prefectCount = Integer.parseInt(PropertiesLoader.getProperty("queue.receive_error.prefetch_count"));
factory.setPrefetchCount(prefectCount);
factory.setConcurrentConsumers(concurrentConsumers);
factory.setMaxConcurrentConsumers(maxConcurrentConsumers);
factory.setConsecutiveActiveTrigger(consecutiveActiveTrigger);
return factory;
}
.properties文件中的信息
queue.receive_error.name=queue.receive_error
queue.receive_error.exchange=auto.receive_error
queue.receive_error.routingKey=receive_error
queue.receive_error.concurrent-consumers=1
queue.receive_error.max-concurrent-consumers=30
queue.receive_error.consecutive-active-trigger=5
queue.receive_error.prefetch_count=1