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 2012/02/02 08:09:23 UTC
svn commit: r1239471 - in /camel/branches/camel-2.9.x: ./
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/impl/
tests/camel-itest/src/test/java/org/apache/camel/itest/jms/
tests/camel-itest/src/test/resources/org/ap...
Author: davsclaus
Date: Thu Feb 2 07:09:23 2012
New Revision: 1239471
URL: http://svn.apache.org/viewvc?rev=1239471&view=rev
Log:
CAMEL-4961: Keep information about transacted redelivered for the lifecycle of the exchange. As the impl of Message can change during routing, and otherwise lose that detail.
Added:
camel/branches/camel-2.9.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
- copied unchanged from r1239470, camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
camel/branches/camel-2.9.x/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.xml
- copied unchanged from r1239470, camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.xml
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/Exchange.java
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 2 07:09:23 2012
@@ -1 +1 @@
-/camel/trunk:1235643,1236639,1236667,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238937,1238988,1239006,1239045,1239080-1239081
+/camel/trunk:1235643,1236639,1236667,1237666,1237807,1238225,1238229,1238387,1238463,1238477,1238503,1238937,1238988,1239006,1239045,1239080-1239081,1239470
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=1239471&r1=1239470&r2=1239471&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/Exchange.java Thu Feb 2 07:09:23 2012
@@ -171,17 +171,18 @@ public interface Exchange {
String SPLIT_COMPLETE = "CamelSplitComplete";
String SPLIT_SIZE = "CamelSplitSize";
- String TIMER_COUNTER = "CamelTimerCounter";
- String TIMER_FIRED_TIME = "CamelTimerFiredTime";
- String TIMER_NAME = "CamelTimerName";
- String TIMER_PERIOD = "CamelTimerPeriod";
- String TIMER_TIME = "CamelTimerTime";
- String TO_ENDPOINT = "CamelToEndpoint";
- String TRACE_EVENT = "CamelTraceEvent";
- String TRACE_EVENT_NODE_ID = "CamelTraceEventNodeId";
- String TRACE_EVENT_TIMESTAMP = "CamelTraceEventTimestamp";
- String TRACE_EVENT_EXCHANGE = "CamelTraceEventExchange";
- String TRANSFER_ENCODING = "Transfer-Encoding";
+ String TIMER_COUNTER = "CamelTimerCounter";
+ String TIMER_FIRED_TIME = "CamelTimerFiredTime";
+ String TIMER_NAME = "CamelTimerName";
+ String TIMER_PERIOD = "CamelTimerPeriod";
+ String TIMER_TIME = "CamelTimerTime";
+ String TO_ENDPOINT = "CamelToEndpoint";
+ String TRACE_EVENT = "CamelTraceEvent";
+ String TRACE_EVENT_NODE_ID = "CamelTraceEventNodeId";
+ String TRACE_EVENT_TIMESTAMP = "CamelTraceEventTimestamp";
+ String TRACE_EVENT_EXCHANGE = "CamelTraceEventExchange";
+ String TRANSACTED_REDELIVERED = "CamelTransactedRedelivered";
+ String TRANSFER_ENCODING = "Transfer-Encoding";
String UNIT_OF_WORK_EXHAUSTED = "CamelUnitOfWorkExhausted";
String UNIT_OF_WORK_PROCESS_SYNC = "CamelUnitOfWorkProcessSync";
Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=1239471&r1=1239470&r2=1239471&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Thu Feb 2 07:09:23 2012
@@ -332,14 +332,30 @@ public final class DefaultExchange imple
}
public Boolean isTransactedRedelivered() {
- // lets avoid adding methods to the Message API, so we use the
- // DefaultMessage to allow component specific messages to extend
- // and implement the isTransactedRedelivered method.
- DefaultMessage msg = getIn(DefaultMessage.class);
- if (msg != null) {
- return msg.isTransactedRedelivered();
+ Boolean answer = null;
+
+ // check property first, as the implementation details to know if the message
+ // was transacted redelivered is message specific, and thus the message implementation
+ // could potentially change during routing, and therefore later we may not know if the
+ // original message was transacted redelivered or not, therefore we store this detail
+ // as a exchange property to keep it around for the lifecycle of the exchange
+ if (hasProperties()) {
+ answer = getProperty(Exchange.TRANSACTED_REDELIVERED, null, Boolean.class);
+ }
+
+ if (answer == null) {
+ // lets avoid adding methods to the Message API, so we use the
+ // DefaultMessage to allow component specific messages to extend
+ // and implement the isTransactedRedelivered method.
+ DefaultMessage msg = getIn(DefaultMessage.class);
+ if (msg != null) {
+ answer = msg.isTransactedRedelivered();
+ // store as property to keep around
+ setProperty(Exchange.TRANSACTED_REDELIVERED, answer);
+ }
}
- return null;
+
+ return answer;
}
public boolean isRollbackOnly() {
Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?rev=1239471&r1=1239470&r2=1239471&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java Thu Feb 2 07:09:23 2012
@@ -108,6 +108,12 @@ public class DefaultUnitOfWork implement
exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbId);
}
}
+
+ // setup whether the exchange is transacted redelivered or not (if not initialized before)
+ // store as property so we know that the origin exchange was transacted redelivered
+ if (exchange.getProperty(Exchange.TRANSACTED_REDELIVERED) == null) {
+ exchange.setProperty(Exchange.TRANSACTED_REDELIVERED, exchange.isTransactedRedelivered());
+ }
// fire event
try {