camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1406087 - in /camel/branches/camel-2.9.x: ./ components/camel-jms/src/main/java/org/apache/camel/component/jms/ components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/
Date Tue, 06 Nov 2012 10:33:18 GMT
Author: davsclaus
Date: Tue Nov  6 10:33:17 2012
New Revision: 1406087

URL: http://svn.apache.org/viewvc?rev=1406087&view=rev
Log:
CAMEL-5390: Option to assign unique correlation ID to JMS messages. Fixed.

Added:
    camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutParallelTest.java
      - copied unchanged from r1406086, camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutParallelTest.java
    camel/branches/camel-2.9.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutRepeatedInvocationsTest.java
      - copied unchanged from r1406086, camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutRepeatedInvocationsTest.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1387808
  Merged /camel/branches/camel-2.10.x:r1406086

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java?rev=1406087&r1=1406086&r2=1406087&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
Tue Nov  6 10:33:17 2012
@@ -52,6 +52,7 @@ import static org.apache.camel.component
  */
 public class JmsProducer extends DefaultAsyncProducer {
     private static final transient Logger LOG = LoggerFactory.getLogger(JmsProducer.class);
+    private static final String GENERATED_CORRELATION_ID_PREFIX = "Camel-";
     private final JmsEndpoint endpoint;
     private final AtomicBoolean started = new AtomicBoolean(false);
     private JmsOperations inOnlyTemplate;
@@ -175,10 +176,13 @@ public class JmsProducer extends Default
         final ValueHolder<MessageSentCallback> sentCallback = new ValueHolder<MessageSentCallback>(messageSentCallback);
 
         final String originalCorrelationId = in.getHeader("JMSCorrelationID", String.class);
-        if (ObjectHelper.isEmpty(originalCorrelationId) && !msgIdAsCorrId) {
-            in.setHeader("JMSCorrelationID", getUuidGenerator().generateUuid());
+        boolean generateFreshCorrId = (ObjectHelper.isEmpty(originalCorrelationId) &&
!msgIdAsCorrId) 
+                || (originalCorrelationId != null && originalCorrelationId.startsWith(GENERATED_CORRELATION_ID_PREFIX));
+        if (generateFreshCorrId) {
+            // we append the 'Camel-' prefix to know it was generated by us
+            in.setHeader("JMSCorrelationID", GENERATED_CORRELATION_ID_PREFIX + getUuidGenerator().generateUuid());
         }
-
+        
         MessageCreator messageCreator = new MessageCreator() {
             public Message createMessage(Session session) throws JMSException {
                 Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session,
null);



Mime
View raw message