camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1303557 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/processor/RedeliveryErrorHandler.java test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java
Date Wed, 21 Mar 2012 20:23:48 GMT
Author: davsclaus
Date: Wed Mar 21 20:23:47 2012
New Revision: 1303557

URL: http://svn.apache.org/viewvc?rev=1303557&view=rev
Log:
CAMEL-5110: Fixed using shareUnitOfWork option with DLC error handler routing to route as
DLQ not working as expected.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java
      - copied, changed from r1303392, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java?rev=1303557&r1=1303556&r2=1303557&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
Wed Mar 21 20:23:47 2012
@@ -719,6 +719,11 @@ public abstract class RedeliveryErrorHan
             exchange.getIn().removeHeader(Exchange.REDELIVERED);
             exchange.getIn().removeHeader(Exchange.REDELIVERY_COUNTER);
             exchange.getIn().removeHeader(Exchange.REDELIVERY_MAX_COUNTER);
+
+            // 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

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java
(from r1303392, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionTest.java&r1=1303392&r2=1303557&rev=1303557&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitSubUnitOfWorkStopOnExceptionIssueTest.java
Wed Mar 21 20:23:47 2012
@@ -16,55 +16,24 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 
 /**
  *
  */
-public class SplitSubUnitOfWorkStopOnExceptionTest extends ContextTestSupport {
-
-    private static int counter;
-
-    public void testOK() throws Exception {
-        counter = 0;
-
-        getMockEndpoint("mock:dead").expectedMessageCount(0);
-        getMockEndpoint("mock:a").expectedBodiesReceived("Tiger,Camel");
-        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Camel");
-        getMockEndpoint("mock:result").expectedBodiesReceived("Tiger,Camel");
-        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger", "Camel");
-
-        template.sendBody("direct:start", "Tiger,Camel");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testError() throws Exception {
-        counter = 0;
-
-        getMockEndpoint("mock:dead").expectedBodiesReceived("Tiger,Donkey,Camel");
-        getMockEndpoint("mock:a").expectedMessageCount(1);
-        getMockEndpoint("mock:b").expectedBodiesReceived("Tiger", "Donkey");
-        getMockEndpoint("mock:result").expectedMessageCount(0);
-        getMockEndpoint("mock:line").expectedBodiesReceived("Tiger");
-
-        template.sendBody("direct:start", "Tiger,Donkey,Camel");
-
-        assertMockEndpointsSatisfied();
-
-        assertEquals(4, counter); // 1 first + 3 redeliveries
-    }
+public class SplitSubUnitOfWorkStopOnExceptionIssueTest extends SplitSubUnitOfWorkStopOnExceptionTest
{
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                errorHandler(deadLetterChannel("mock:dead").useOriginalMessage()
+                errorHandler(deadLetterChannel("direct:dead").useOriginalMessage()
                         .maximumRedeliveries(3).redeliveryDelay(0));
+                
+                from("direct:dead")
+                    .setBody(simple("${body}"))
+                    .to("mock:dead");
 
                 from("direct:start")
                     .to("mock:a")
@@ -83,16 +52,4 @@ public class SplitSubUnitOfWorkStopOnExc
         };
     }
 
-    public static class MyProcessor implements Processor {
-
-        @Override
-        public void process(Exchange exchange) throws Exception {
-            String body = exchange.getIn().getBody(String.class);
-            if (body.contains("Donkey")) {
-                counter++;
-                throw new IllegalArgumentException("Donkey not allowed");
-            }
-        }
-    }
-
 }



Mime
View raw message