camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r1152868 - in /camel/trunk/components/camel-jms/src: main/java/org/apache/camel/component/jms/ test/java/org/apache/camel/component/jms/
Date Mon, 01 Aug 2011 17:32:19 GMT
Author: janstey
Date: Mon Aug  1 17:32:17 2011
New Revision: 1152868

URL: http://svn.apache.org/viewvc?rev=1152868&view=rev
Log:
CAMEL-4290 - Add idleConsumerLimit option for DMLC to camel-jms

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentTest.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?rev=1152868&r1=1152867&r2=1152868&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Mon Aug  1 17:32:17 2011
@@ -217,6 +217,10 @@ public class JmsComponent extends Defaul
     public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) {
         getConfiguration().setIdleTaskExecutionLimit(idleTaskExecutionLimit);
     }
+    
+    public void setIdleConsumerLimit(int idleConsumerLimit) {
+        getConfiguration().setIdleConsumerLimit(idleConsumerLimit);
+    }
 
     public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
         getConfiguration().setMaxConcurrentConsumers(maxConcurrentConsumers);

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java?rev=1152868&r1=1152867&r2=1152868&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
Mon Aug  1 17:32:17 2011
@@ -80,6 +80,7 @@ public class JmsConfiguration implements
     private long receiveTimeout = -1;
     private long requestTimeout = 20000L;
     private int idleTaskExecutionLimit = 1;
+    private int idleConsumerLimit = 1;
     private int maxConcurrentConsumers;
     // JmsTemplate only
     private Boolean explicitQosEnabled;
@@ -585,6 +586,14 @@ public class JmsConfiguration implements
         this.idleTaskExecutionLimit = idleTaskExecutionLimit;
     }
 
+    public int getIdleConsumerLimit() {
+        return idleConsumerLimit;
+    }
+
+    public void setIdleConsumerLimit(int idleConsumerLimit) {
+        this.idleConsumerLimit = idleConsumerLimit;
+    }
+    
     public int getMaxConcurrentConsumers() {
         return maxConcurrentConsumers;
     }
@@ -862,6 +871,9 @@ public class JmsConfiguration implements
         if (idleTaskExecutionLimit >= 0) {
             container.setIdleTaskExecutionLimit(idleTaskExecutionLimit);
         }
+        if (idleConsumerLimit >= 0) {
+            container.setIdleConsumerLimit(idleConsumerLimit);
+        }        
         if (maxConcurrentConsumers > 0) {
             if (maxConcurrentConsumers < concurrentConsumers) {
                 throw new IllegalArgumentException("Property maxConcurrentConsumers: " +
maxConcurrentConsumers

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java?rev=1152868&r1=1152867&r2=1152868&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
Mon Aug  1 17:32:17 2011
@@ -496,6 +496,11 @@ public class JmsEndpoint extends Default
         return getConfiguration().getIdleTaskExecutionLimit();
     }
 
+    @ManagedAttribute
+    public int getIdleConsumerLimit() {
+        return getConfiguration().getIdleConsumerLimit();
+    }
+    
     public JmsOperations getJmsOperations() {
         return getConfiguration().getJmsOperations();
     }
@@ -758,6 +763,11 @@ public class JmsEndpoint extends Default
         getConfiguration().setIdleTaskExecutionLimit(idleTaskExecutionLimit);
     }
 
+    @ManagedAttribute
+    public void setIdleConsumerLimit(int idleConsumerLimit) {
+        getConfiguration().setIdleConsumerLimit(idleConsumerLimit);
+    }
+    
     public void setJmsOperations(JmsOperations jmsOperations) {
         getConfiguration().setJmsOperations(jmsOperations);
     }

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentTest.java?rev=1152868&r1=1152867&r2=1152868&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentTest.java
Mon Aug  1 17:32:17 2011
@@ -47,6 +47,7 @@ public class JmsComponentTest extends Ca
         assertEquals(true, endpoint.isDeliveryPersistent());
         assertEquals(true, endpoint.isExplicitQosEnabled());
         assertEquals(20, endpoint.getIdleTaskExecutionLimit());
+        assertEquals(21, endpoint.getIdleConsumerLimit());        
         assertEquals(5, endpoint.getMaxConcurrentConsumers());
         assertEquals(90, endpoint.getMaxMessagesPerTask());
         assertEquals(3, endpoint.getPriority());
@@ -73,6 +74,7 @@ public class JmsComponentTest extends Ca
         comp.setDeliveryPersistent(true);
         comp.setExplicitQosEnabled(true);
         comp.setIdleTaskExecutionLimit(20);
+        comp.setIdleConsumerLimit(21);
         comp.setMaxConcurrentConsumers(5);
         comp.setMaxMessagesPerTask(90);
         comp.setPriority(3);

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java?rev=1152868&r1=1152867&r2=1152868&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java
Mon Aug  1 17:32:17 2011
@@ -173,6 +173,13 @@ public class JmsEndpointConfigurationTes
     }
 
     @Test
+    public void testIdleConsumerLimit() throws Exception {
+        JmsEndpoint endpoint = (JmsEndpoint) resolveMandatoryEndpoint("jms:queue:Foo?idleConsumerLimit=51");
+        assertEquals(51, endpoint.getIdleConsumerLimit());
+        assertEquals(true, endpoint.isAutoStartup());
+    }
+    
+    @Test
     public void testLazyCreateTransactionManager() throws Exception {
         JmsEndpoint endpoint = (JmsEndpoint) resolveMandatoryEndpoint("jms:queue:Foo?lazyCreateTransactionManager=true");
         assertEquals(true, endpoint.getConfiguration().isLazyCreateTransactionManager());
@@ -204,6 +211,7 @@ public class JmsEndpointConfigurationTes
         assertEquals("jms://queue:Foo", endpoint.getEndpointUri());
         assertNull(endpoint.getExceptionListener());
         assertEquals(1, endpoint.getIdleTaskExecutionLimit());
+        assertEquals(1, endpoint.getIdleConsumerLimit());
         assertEquals(null, endpoint.getJmsMessageType());
         assertNull(endpoint.getJmsOperations());
         assertNotNull(endpoint.getListenerConnectionFactory());
@@ -305,6 +313,9 @@ public class JmsEndpointConfigurationTes
         endpoint.setIdleTaskExecutionLimit(5);
         assertEquals(5, endpoint.getIdleTaskExecutionLimit());
 
+        endpoint.setIdleConsumerLimit(5);
+        assertEquals(5, endpoint.getIdleConsumerLimit());
+        
         endpoint.setMaxConcurrentConsumers(4);
         assertEquals(4, endpoint.getMaxConcurrentConsumers());
 



Mime
View raw message