You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/01/24 15:54:42 UTC
svn commit: r1438031 - in /camel/branches/camel-2.10.x: ./
camel-core/src/main/java/org/apache/camel/processor/
camel-core/src/test/java/org/apache/camel/processor/
components/camel-spring/src/test/resources/org/apache/camel/spring/processor/
Author: ningjiang
Date: Thu Jan 24 14:54:42 2013
New Revision: 1438031
URL: http://svn.apache.org/viewvc?rev=1438031&view=rev
Log:
CAMEL-6005 fixed the issue of using shareUnitOfWork within multicast
Merged revisions 1438017 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1438017 | ningjiang | 2013-01-24 22:32:32 +0800 (Thu, 24 Jan 2013) | 1 line
CAMEL-6005 fixed the issue of using shareUnitOfWork within multicast
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1438017
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1438031&r1=1438030&r2=1438031&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Thu Jan 24 14:54:42 2013
@@ -877,9 +877,12 @@ public class MulticastProcessor extends
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
-
- // add to cache
- errorHandlers.putIfAbsent(key, answer);
+ // here we don't cache the ChildUnitOfWorkProcessor
+ // As the UnitOfWorkProcess will be delegate to the Parent
+ if (!(answer instanceof ChildUnitOfWorkProcessor)) {
+ // add to cache
+ errorHandlers.putIfAbsent(key, answer);
+ }
} else {
// and wrap in unit of work processor so the copy exchange also can run under UoW
answer = createUnitOfWorkProcessor(routeContext, processor, exchange);
Modified: camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java?rev=1438031&r1=1438030&r2=1438031&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/MulticastSubUnitOfWorkTest.java Thu Jan 24 14:54:42 2013
@@ -58,6 +58,14 @@ public class MulticastSubUnitOfWorkTest
assertEquals(4, counter); // 1 first + 3 redeliveries
}
+
+ public void testMulticastException() throws Exception {
+ getMockEndpoint("mock:dead").expectedBodiesReceived("Hello", "Hi", "Bye");
+ template.sendBody("direct:e", "Hello");
+ template.sendBody("direct:e", "Hi");
+ template.sendBody("direct:e", "Bye");
+ assertMockEndpointsSatisfied();
+ }
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
@@ -82,6 +90,12 @@ public class MulticastSubUnitOfWorkTest
from("direct:b")
.process(new MyProcessor())
.to("mock:b");
+
+ from("direct:e")
+ .multicast().shareUnitOfWork()
+ .throwException(new IllegalArgumentException("exception1"))
+ .throwException(new IllegalArgumentException("exception2"))
+ .end();
}
};
}
Modified: camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml?rev=1438031&r1=1438030&r2=1438031&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml (original)
+++ camel/branches/camel-2.10.x/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringMulticastSubUnitOfWorkTest.xml Thu Jan 24 14:54:42 2013
@@ -24,6 +24,7 @@
<bean id="myPreProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyPreProcessor"/>
<bean id="myProcessor" class="org.apache.camel.processor.MulticastSubUnitOfWorkTest$MyProcessor"/>
+ <bean name="anException" class="java.lang.IllegalArgumentException"/>
<!-- START SNIPPET: e1 -->
<camelContext errorHandlerRef="dlc" xmlns="http://camel.apache.org/schema/spring">
@@ -57,6 +58,14 @@
<process ref="myProcessor"/>
<to uri="mock:b"/>
</route>
+
+ <route>
+ <from uri="direct:e"/>
+ <multicast shareUnitOfWork="true">
+ <throwException ref="anException"/>
+ <throwException ref="anException"/>
+ </multicast>
+ </route>
</camelContext>
<!-- END SNIPPET: e1 -->