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

loopDoWhile with delay does not see end of loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 3.5.0
    • 3.7.0
    • camel-core
    • None
    • Unknown

    Description

      "LoopDoWhile" with "delay" in the body of the loop does not see the "end" and calls steps after the "end" during each iteration.
      How to reproduce:
      In the test of org.apache.camel.processor.LoopDoWhileTest add "delay" into the route configuration

      @Override
          protected RouteBuilder createRouteBuilder() throws Exception {
              return new RouteBuilder() {
                  @Override
                  public void configure() throws Exception {
                      from("direct:simple").loopDoWhile(simple("${body.length} <= 5"))                        
                              .to("mock:loop")
                              .transform(body().append("A"))
                              .delay(1000).asyncDelayed()
                              .end().to("mock:result");
      
                      from("direct:functional").loopDoWhile().body(String.class, b -> b.length() <= 5)
                              .delay(1000).syncDelayed()
                              .to("mock:loop").transform()
                              .body(String.class, b -> b += "A").end()
                              .to("mock:result");
                  }
              };
          }
      

      After that both tests will fall

      java.lang.AssertionError: mock://result Body of message: 0. Expected: <AAAAAA> but was: <AA>
      Expected :<AAAAAA>
      Actual   :<AA>
      <Click to see difference>
      

      The syncDelayed or asyncDelayed options does not affect the result.
       

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            ask77 Alexander Kizchenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: