Author: davsclaus
Date: Sat Apr 21 14:58:05 2012
New Revision: 1328679
URL: http://svn.apache.org/viewvc?rev=1328679&view=rev
Log:
CAMEL-5201: redelivery exhausted marker should be cleared by try catch EIP and
when errorHandler handles the message
Modified:
camel/branches/camel-2.8.x/ (props changed)
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1328675
Merged /camel/branches/camel-2.9.x:r1328677
Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java?rev=1328679&r1=1328678&r2=1328679&view=diff
==============================================================================
---
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
(original)
+++
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
Sat Apr 21 14:58:05 2012
@@ -693,6 +693,12 @@ public abstract class RedeliveryErrorHan
exchange.getIn().removeHeader(Exchange.REDELIVERED);
exchange.getIn().removeHeader(Exchange.REDELIVERY_COUNTER);
exchange.getIn().removeHeader(Exchange.REDELIVERY_MAX_COUNTER);
+ exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED);
+
+ // and remove traces of rollback only and uow exhausted markers
+ exchange.removeProperty(Exchange.ROLLBACK_ONLY);
+ exchange.removeProperty(Exchange.UNIT_OF_WORK_EXHAUSTED);
+
handled = true;
} else {
// must decrement the redelivery counter as we didn't process the
redelivery but is
@@ -875,6 +881,13 @@ public abstract class RedeliveryErrorHan
*/
private boolean isExhausted(Exchange exchange, RedeliveryData data) {
// if marked as rollback only then do not continue/redeliver
+ boolean exhausted =
exchange.getProperty(Exchange.REDELIVERY_EXHAUSTED, false, Boolean.class);
+ if (exhausted) {
+ log.trace("This exchange is marked as redelivery exhausted: {}",
exchange);
+ return true;
+ }
+
+ // if marked as rollback only then do not continue/redeliver
boolean rollbackOnly = exchange.getProperty(Exchange.ROLLBACK_ONLY,
false, Boolean.class);
if (rollbackOnly) {
log.trace("This exchange is marked as rollback only, so forcing it
to be exhausted: {}", exchange);
Modified:
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?rev=1328679&r1=1328678&r2=1328679&view=diff
==============================================================================
---
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
(original)
+++
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
Sat Apr 21 14:58:05 2012
@@ -381,6 +381,8 @@ public class TryProcessor extends Servic
exchange.setException(exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Exception.class));
}
}
+ // always clear redelivery exhausted in a catch clause
+ exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED);
// signal callback to continue routing async
ExchangeHelper.prepareOutToIn(exchange);
@@ -395,6 +397,8 @@ public class TryProcessor extends Servic
exchange.setException(exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
Exception.class));
}
}
+ // always clear redelivery exhausted in a catch clause
+ exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED);
}
return sync;