You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/04/03 07:49:19 UTC

svn commit: r1463833 - in /camel/branches/camel-2.10.x: ./ components/camel-jms/ components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ components/camel-jms/src/test/java/org/apache/camel/component/jms/

Author: davsclaus
Date: Wed Apr  3 05:49:19 2013
New Revision: 1463833

URL: http://svn.apache.org/r1463833
Log:
CAMEL-6218 camel-jms: transferExchange option now works as expected, trasferring body, headers and properties back and forth in request/reply scenarios

Added:
    camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
      - copied unchanged from r1463799, camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutTransferExchangeTest.java
    camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/SerializableRequestDto.java
      - copied unchanged from r1463799, camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SerializableRequestDto.java
    camel/branches/camel-2.10.x/components/camel-jms/src/test/java/org/apache/camel/component/jms/SerializableResponseDto.java
      - copied unchanged from r1463799, camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/SerializableResponseDto.java
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-jms/   (props changed)
    camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1463799

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

Propchange: camel/branches/camel-2.10.x/components/camel-jms/
------------------------------------------------------------------------------
  Merged /camel/trunk/components/camel-jms:r1463799

Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java?rev=1463833&r1=1463832&r2=1463833&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java (original)
+++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java Wed Apr  3 05:49:19 2013
@@ -133,17 +133,19 @@ public abstract class ReplyManagerSuppor
                     exchange.setException(new ExchangeTimedOutException(exchange, holder.getRequestTimeout(), msg));
                 } else {
                     JmsMessage response = new JmsMessage(message, endpoint.getBinding());
+                    // the JmsBinding is designed to be "pull-based": it will populate the Camel message on demand
+                    // therefore, we link Exchange and OUT message before continuing, so that the JmsBinding has full access 
+                    // to everything it may need, and can populate headers, properties, etc. accordingly (solves CAMEL-6218).
+                    exchange.setOut(response);
                     Object body = response.getBody();
 
                     if (endpoint.isTransferException() && body instanceof Exception) {
-                        log.debug("Reply received. Setting reply as an Exception: {}", body);
+                        log.debug("Reply was an Exception. Setting the Exception on the Exchange: {}", body);
                         // we got an exception back and endpoint was configured to transfer exception
                         // therefore set response as exception
                         exchange.setException((Exception) body);
                     } else {
-                        log.debug("Reply received. Setting reply as OUT message: {}", body);
-                        // regular response
-                        exchange.setOut(response);
+                        log.debug("Reply received. OUT message body set to reply payload: {}", body);
                     }
 
                     // restore correlation id in case the remote server messed with it