[ 
https://issues.apache.org/jira/browse/CAMEL-6378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-6378.
--------------------------------

    Resolution: Fixed

CAMEL-6659 has a better solution.
                
> Java DSL - Using transacted and onException in same route - Validate that 
> onException is first
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6378
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6378
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.12.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.12.0
>
>
> 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)
> {code}
> --- 
> 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");
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to