camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r1393102 - in /camel/branches/camel-2.10.x/components/camel-jms/src: main/java/org/apache/camel/component/jms/ test/java/org/apache/camel/component/jms/
Date Tue, 02 Oct 2012 19:04:19 GMT
Author: janstey
Date: Tue Oct  2 19:04:18 2012
New Revision: 1393102

URL: http://svn.apache.org/viewvc?rev=1393102&view=rev
Log:
CAMEL-5676 - Allow for custom listener container in camel-jms

Modified:
    camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/ConsumerType.java
    camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
    camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
    camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestCustomReplyToTest.java

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/ConsumerType.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/ConsumerType.java?rev=1393102&r1=1393101&r2=1393102&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/ConsumerType.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/ConsumerType.java
Tue Oct  2 19:04:18 2012
@@ -20,5 +20,5 @@ package org.apache.camel.component.jms;
  * @version 
  */
 public enum ConsumerType {
-    Simple, Default
+    Simple, Default, Custom
 }

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?rev=1393102&r1=1393101&r2=1393102&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Tue Oct  2 19:04:18 2012
@@ -35,6 +35,7 @@ import org.springframework.core.task.Tas
 import org.springframework.jms.connection.JmsTransactionManager;
 import org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter;
 import org.springframework.jms.core.JmsOperations;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 import org.springframework.jms.support.converter.MessageConverter;
 import org.springframework.jms.support.destination.DestinationResolver;
 import org.springframework.transaction.PlatformTransactionManager;
@@ -496,7 +497,14 @@ public class JmsComponent extends Defaul
             endpoint.setJmsKeyFormatStrategy(resolveAndRemoveReferenceParameter(
                     parameters, KEY_FORMAT_STRATEGY_PARAM, JmsKeyFormatStrategy.class));
         }
-
+        
+        // remove the listener from the registry because we cannot reuse it for a 2nd endpoint
+        AbstractMessageListenerContainer customMessageListenerContainer = resolveAndRemoveReferenceParameter(
+        		parameters, "customMessageListenerContainerRef", AbstractMessageListenerContainer.class);
+        if (customMessageListenerContainer != null) {
+        	endpoint.setCustomMessageListenerContainer(customMessageListenerContainer);    
   	
+        }
+        
         setProperties(endpoint.getConfiguration(), parameters);
         endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy());
 

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java?rev=1393102&r1=1393101&r2=1393102&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
Tue Oct  2 19:04:18 2012
@@ -135,6 +135,7 @@ public class JmsConfiguration implements
     // the cacheLevelName of reply manager
     private String replyToCacheLevelName;
     private boolean allowNullBody = true;
+	private AbstractMessageListenerContainer customMessageListenerContainer;
 
     public JmsConfiguration() {
     }
@@ -383,6 +384,8 @@ public class JmsConfiguration implements
             return new SimpleJmsMessageListenerContainer(endpoint);
         case Default:
             return new DefaultJmsMessageListenerContainer(endpoint);
+        case Custom:
+            return getCustomMessageListenerContainer();            
         default:
             throw new IllegalArgumentException("Unknown consumer type: " + consumerType);
         }
@@ -1277,4 +1280,13 @@ public class JmsConfiguration implements
     public void setAllowNullBody(boolean allowNullBody) {
         this.allowNullBody = allowNullBody;
     }
+
+	public AbstractMessageListenerContainer getCustomMessageListenerContainer() {
+	    return customMessageListenerContainer;
+    }
+
+	public void setCustomMessageListenerContainer(
+            AbstractMessageListenerContainer customMessageListenerContainer) {
+	    this.customMessageListenerContainer = customMessageListenerContainer;
+    }
 }

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java?rev=1393102&r1=1393101&r2=1393102&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
Tue Oct  2 19:04:18 2012
@@ -1040,6 +1040,16 @@ public class JmsEndpoint extends Default
     public void setAllowNullBody(boolean allowNullBody) {
         configuration.setAllowNullBody(allowNullBody);
     }
+    
+	public AbstractMessageListenerContainer getCustomMessageListenerContainer() {
+	    return configuration.getCustomMessageListenerContainer();
+    }
+
+	public void setCustomMessageListenerContainer(
+            AbstractMessageListenerContainer customMessageListenerContainer) {
+	    configuration.setCustomMessageListenerContainer(customMessageListenerContainer);
+	    configuration.setConsumerType(ConsumerType.Custom);
+    }
 
     @ManagedAttribute
     public String getReplyToType() {

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestCustomReplyToTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestCustomReplyToTest.java?rev=1393102&r1=1393101&r2=1393102&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestCustomReplyToTest.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSimpleRequestCustomReplyToTest.java
Tue Oct  2 19:04:18 2012
@@ -48,7 +48,7 @@ public class JmsSimpleRequestCustomReply
     @Test
     public void testRequetCustomReplyTo() throws Exception {
         // use another thread to send the late reply to simulate that we do it later, not
-        // from the origianl route anyway
+        // from the original route anyway
         Thread sender = new Thread(new SendLateReply());
         sender.start();
 



Mime
View raw message