@Override protected void validateConfiguration() { super.validateConfiguration(); if (isSubscriptionDurable() && this.concurrentConsumers != 1) { throw new IllegalArgumentException( "Only 1 concurrent consumer supported for durable subscription"); } }
/** * Avoid the possibility of not configuring the CachingConnectionFactory in sync with the number * of concurrent consumers. */ @Override protected void validateConfiguration() { super.validateConfiguration(); Assert.state( !(getAcknowledgeMode().isAutoAck() && transactionManager != null), "The acknowledgeMode is NONE (autoack in Rabbit terms) which is not consistent with having an " + "external transaction manager. Either use a different AcknowledgeMode or make sure the transactionManager is null."); if (this.getConnectionFactory() instanceof CachingConnectionFactory) { CachingConnectionFactory cf = (CachingConnectionFactory) getConnectionFactory(); if (cf.getChannelCacheSize() < this.concurrentConsumers) { cf.setChannelCacheSize(this.concurrentConsumers); logger.warn( "CachingConnectionFactory's channelCacheSize can not be less than the number of concurrentConsumers so it was reset to match: " + this.concurrentConsumers); } } }