camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1200262 - /camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
Date Thu, 10 Nov 2011 10:46:37 GMT
Author: davsclaus
Date: Thu Nov 10 10:46:36 2011
New Revision: 1200262

URL: http://svn.apache.org/viewvc?rev=1200262&view=rev
Log:
CAMEL-4656: Optimized request/reply over JMS with fixed reply queues. We can cache consumer
for exclusive and when using a fixed reply to selector value.

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java?rev=1200262&r1=1200261&r2=1200262&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
Thu Nov 10 10:46:36 2011
@@ -128,15 +128,22 @@ public class PersistentQueueReplyManager
                 replyToSelectorValue = "ID:" + new BigInteger(24 * 8, new Random()).toString(16);
                 String fixedMessageSelector = replyToSelectorName + "='" + replyToSelectorValue
+ "'";
                 answer = new SharedPersistentQueueMessageListenerContainer(fixedMessageSelector);
+                // must use cache level consumer for fixed message selector
+                answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
                 log.debug("Using shared queue: " + endpoint.getReplyTo() + " with fixed message
selector [" + fixedMessageSelector + "] as reply listener: " + answer);
             } else {
                 // use a dynamic message selector which will select the message we want to
receive as reply
                 dynamicMessageSelector = new MessageSelectorCreator(correlation);
                 answer = new SharedPersistentQueueMessageListenerContainer(dynamicMessageSelector);
+                // must use cache level session for dynamic message selector,
+                // as otherwise the dynamic message selector will not be updated on-the-fly
+                answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION);
                 log.debug("Using shared queue: " + endpoint.getReplyTo() + " with dynamic
message selector as reply listener: " + answer);
             }
         } else if (ReplyToType.Exclusive == type) {
             answer = new ExclusivePersistentQueueMessageListenerContainer();
+            // must use cache level consumer for exclusive as there is no message selector
+            answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
             log.debug("Using exclusive queue:" + endpoint.getReplyTo() + " as reply listener:
" + answer);
         } else {
             throw new IllegalArgumentException("ReplyToType " + type + " is not supported
for persistent reply queues");
@@ -161,8 +168,6 @@ public class PersistentQueueReplyManager
             clientId += ".CamelReplyManager";
             answer.setClientId(clientId);
         }
-        // must use cache level session
-        answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION);
 
         // we cannot do request-reply over JMS with transaction
         answer.setSessionTransacted(false);



Mime
View raw message