Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18288

YAML DSL DoTry does not work

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      The following two routes expected to work the same way:

      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.model.language.GroovyExpression;
      
      public class Test extends RouteBuilder {
          @Override
          public void configure() throws Exception {
      
              from("timer:demo")
                      .doTry()
                          .setBody(new GroovyExpression("100/10"))
                      .doCatch(ArithmeticException.class)
                          .log("Exception")
                      .doFinally()
                          .log("${body}");    
          }
      }
      
       - route:
          from:
            uri: timer:demo
            steps:
              - doTry:
                  steps:
                    - setBody:
                        expression:
                          groovy:
                            expression: 1000 / 0
                  doCatch:
                    - steps:
                        - log:
                            message: Exception
                      exception:
                        - java.lang.ArithmeticException
                  doFinally:
                      steps:
                        - log:
                            message: ${body} 
      

      However Java version works fine, but YAML version does not catch exception and does not execute doFinally

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              marat.gubaidullin@gmail.com Marat Gubaidullin
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: