Remove RabbitMQ AutoConfig Boolean Coercion

See gh-23799
This commit is contained in:
Gary Russell
2020-10-21 11:32:25 -04:00
committed by Stephane Nicoll
parent da753300a1
commit 32ce453997
2 changed files with 1 additions and 9 deletions

View File

@@ -40,9 +40,6 @@ public final class SimpleRabbitListenerContainerFactoryConfigurer
map.from(config::getMaxConcurrency).whenNonNull().to(factory::setMaxConcurrentConsumers);
map.from(config::getBatchSize).whenNonNull().to(factory::setBatchSize);
map.from(config::isConsumerBatchEnabled).to(factory::setConsumerBatchEnabled);
if (config.isConsumerBatchEnabled()) {
factory.setDeBatchingEnabled(true);
}
}
}

View File

@@ -33,7 +33,6 @@ import com.rabbitmq.client.impl.CredentialsRefreshService;
import com.rabbitmq.client.impl.DefaultCredentialsProvider;
import org.aopalliance.aop.Advice;
import org.junit.jupiter.api.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
import org.springframework.amqp.core.AcknowledgeMode;
@@ -556,17 +555,13 @@ class RabbitAutoConfigurationTests {
void testSimpleRabbitListenerContainerFactoryConfigurerEnableDeBatchingWithConsumerBatchEnabled() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.listener.type:direct",
"spring.rabbitmq.listener.simple.consumer-batch-enabled:true",
"spring.rabbitmq.listener.simple.de-batching-enabled:false")
"spring.rabbitmq.listener.simple.consumer-batch-enabled:true")
.run((context) -> {
SimpleRabbitListenerContainerFactoryConfigurer configurer = context
.getBean(SimpleRabbitListenerContainerFactoryConfigurer.class);
SimpleRabbitListenerContainerFactory factory = mock(SimpleRabbitListenerContainerFactory.class);
configurer.configure(factory, mock(ConnectionFactory.class));
InOrder inOrder = Mockito.inOrder(factory);
verify(factory).setConsumerBatchEnabled(true);
inOrder.verify(factory).setDeBatchingEnabled(false);
inOrder.verify(factory).setDeBatchingEnabled(true);
});
}