Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.12.0
-
None
-
Unknown
Description
When you use Java DSL then the order how you specify transacted / policy / onException matter.
In XML DSL (we have a chance to fix this internally in Camel, so the order there doesnt not matter as much).
We should add validation to the Java DSL so people can configure this correctly. Otherwise we just have too much on our plate to support any kind of order of all these cross cutting functionality being used in the DSL.
Here is an unit test that required a chance to work correctly (eg onException should be first)
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithLocalOnExceptionT +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithLocalOnExceptionT @@ -28,22 +28,22 @@ public class TransactionalClientDataSourceTransactedWithLocalOnExceptionTest ext return new SpringRouteBuilder() { public void configure() throws Exception { from("direct:okay") - .transacted() // use local on exception .onException(IllegalArgumentException.class) .handled(false) .to("mock:error") .end() + .transacted() .setBody(constant("Tiger in Action")).beanRef("bookService") .setBody(constant("Elephant in Action")).beanRef("bookService"); from("direct:fail") - .transacted() // use local on exception .onException(IllegalArgumentException.class) .handled(false) .to("mock:error") .end() + .transacted() .setBody(constant("Tiger in Action")).beanRef("bookService") .setBody(constant("Donkey in Action")).beanRef("bookService");
Attachments
Issue Links
- requires
-
CAMEL-6659 Validate that onException,onCompletion etc must be configured at top-level in the rotues
- Resolved