Polish "Add option for configuring max messages per task"

See gh-42341
This commit is contained in:
Stéphane Nicoll 2024-09-19 14:19:01 +02:00
parent 09b57eff76
commit e930a963ad
2 changed files with 5 additions and 3 deletions

View File

@ -187,7 +187,9 @@ public class JmsProperties {
private Duration receiveTimeout = Duration.ofSeconds(1);
/**
* Specify the maximum number of messages to process in one task.
* Specify the maximum number of messages to process in one task. By default,
* unlimited unless a SchedulingTaskExecutor is configured on the listener (10
* messages), as it indicates a preference for short-lived tasks.
*/
private Integer maxMessagesPerTask;

View File

@ -177,7 +177,7 @@ class JmsAutoConfigurationTests {
"spring.jms.listener.session.transacted=false", "spring.jms.listener.minConcurrency=2",
"spring.jms.listener.receiveTimeout=2s", "spring.jms.listener.maxConcurrency=10",
"spring.jms.subscription-durable=true", "spring.jms.client-id=exampleId",
"spring.jms.listener.max-messages-per-task=10")
"spring.jms.listener.max-messages-per-task=5")
.run(this::testJmsListenerContainerFactoryWithCustomSettings);
}
@ -189,7 +189,7 @@ class JmsAutoConfigurationTests {
assertThat(container.getConcurrentConsumers()).isEqualTo(2);
assertThat(container.getMaxConcurrentConsumers()).isEqualTo(10);
assertThat(container).hasFieldOrPropertyWithValue("receiveTimeout", 2000L);
assertThat(container).hasFieldOrPropertyWithValue("maxMessagesPerTask", 10);
assertThat(container).hasFieldOrPropertyWithValue("maxMessagesPerTask", 5);
assertThat(container.isSubscriptionDurable()).isTrue();
assertThat(container.getClientId()).isEqualTo("exampleId");
}