Consumer Batching Polishing

Change boolean assertion; simply enforce the condition.
This commit is contained in:
Gary Russell
2020-10-21 10:43:16 -04:00
parent 6ed9925f3c
commit 14dee1f16a

View File

@@ -357,7 +357,8 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
/**
* Set to true to present a list of messages based on the {@link #setBatchSize(int)},
* if the listener supports it.
* if the listener supports it. This will coerce {@link #setDeBatchingEnabled(boolean)
* deBatchingEnabled} to true as well.
* @param consumerBatchEnabled true to create message batches in the container.
* @since 2.2
* @see #setBatchSize(int)
@@ -512,8 +513,9 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
@Override
protected void doInitialize() {
Assert.state(!this.consumerBatchEnabled || isDeBatchingEnabled(),
"When setting 'consumerBatchEnabled' to true, 'deBatchingEnabled' must also be true");
if (this.consumerBatchEnabled) {
setDeBatchingEnabled(true);
}
}
@ManagedMetric(metricType = MetricType.GAUGE)