This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 379c1efaabd CAMEL-21908: camel-jms - Property 'idleReceivesPerTaskLimit' is not populated to spring-jms. Thanks to Krzysztof Mackowiak for the patch. 379c1efaabd is described below commit 379c1efaabdac4ea3697e48b952240fa0844a40e Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Apr 8 13:01:18 2025 +0200 CAMEL-21908: camel-jms - Property 'idleReceivesPerTaskLimit' is not populated to spring-jms. Thanks to Krzysztof Mackowiak for the patch. --- .../main/java/org/apache/camel/component/jms/JmsConfiguration.java | 5 ++++- .../org/apache/camel/component/jms/JmsEndpointConfigurationTest.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java index d56ae4544e4..bb86fa51631 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java @@ -166,7 +166,7 @@ public class JmsConfiguration implements Cloneable { + " This setting differs from setMaxMessagesPerTask where the task is released and re-scheduled after this limit is reached, no matter if the received messages were null or non-null messages. This setting alone can be inflexible if one desires to have a large enough batch for each task but requires a quick(er) release from the moment there are no more messages to process." + " This setting differs from setIdleTaskExecutionLimit where this limit decides after how many iterations of being marked as idle, a task is released." + " For example: If setMaxMessagesPerTask is set to '500' and #setIdleReceivesPerTaskLimit is set to '60' and setReceiveTimeout is set to '1000' and setIdleTaskExecutionLimit is set to '1', then 500 messages per task would be processed unless there is a subsequent number of 60 idle messages received, the task would be marked as idle and released. This also means that after the last message was processed, the task would be released after 60 seconds as long as n [...] - private int idleReceivesPerTaskLimit; + private int idleReceivesPerTaskLimit = Integer.MIN_VALUE; @UriParam(label = "consumer", description = "Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details.") private int cacheLevel = -1; @@ -1766,6 +1766,9 @@ public class JmsConfiguration implements Cloneable { if (maxMessagesPerTask >= 0) { container.setMaxMessagesPerTask(maxMessagesPerTask); } + if (idleReceivesPerTaskLimit != Integer.MIN_VALUE) { + container.setIdleReceivesPerTaskLimit(idleReceivesPerTaskLimit); + } container.setPubSubNoLocal(pubSubNoLocal); if (receiveTimeout >= 0) { container.setReceiveTimeout(receiveTimeout); diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java index 9501f987198..f6c7d2b25a5 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java @@ -383,7 +383,7 @@ public class JmsEndpointConfigurationTest implements CamelTestSupportHelper { assertNotNull(endpoint.getConfiguration().getOrCreateListenerConnectionFactory()); assertEquals(0, endpoint.getMaxConcurrentConsumers()); assertEquals(-1, endpoint.getMaxMessagesPerTask()); - assertEquals(0, endpoint.getIdleReceivesPerTaskLimit()); + assertEquals(Integer.MIN_VALUE, endpoint.getIdleReceivesPerTaskLimit()); assertNull(endpoint.getMessageConverter()); assertNotEquals(0, endpoint.getPriority()); assertNotEquals(0, endpoint.getReceiveTimeout());