Skip to content

Commit

Permalink
Polish "Add option for configuring max messages per task"
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Sep 19, 2024
1 parent 09b57ef commit e930a96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ public static class Listener {
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void testJmsListenerContainerFactoryWithCustomSettings() {
"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);
}

Expand All @@ -189,7 +189,7 @@ private void testJmsListenerContainerFactoryWithCustomSettings(AssertableApplica
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");
}
Expand Down

0 comments on commit e930a96

Please sign in to comment.