title: Camel Apache: can I use a retryWhile to re-send a request?
body: <p>I would like to achieve the following kind of orchestration with CAMEL:</p>
  
  <ol>
  <li>Client sends a HTTP POST request to CAMEL</li>
  <li>CAMEL sends HTTP POST request to external endpoint (server)</li>
  <li>External server replies with a 200 OK</li>
  <li>CAMEL sends HTTP GET request to external endpoint (server)</li>
  <li>External server replies</li>
  </ol>
  
  <p>After step 5, I want to check the reply: if the reply is a 200 OK and state = INPROGRESS (this state can be retrieved from the received XML body), I want to re-transmit the HTTP GET to the external endpoint until the state is different from INPROGRESS.</p>
  
  <p>I was thinking to use the retryWhile statement, but I am not sure how to build the routine within the route.
  Eg, for checking whether the reply is a 200 OK and state = INPROGRESS, I can easily introduce a Predicate. So the retryWhile already becomes like:</p>
  
  <p>.retryWhile(Is200OKandINPROGRESS)</p>
  
  <p>but where should I place it in the route so that the HTTP GET will be re-transmitted ?</p>
  
  <p>Eg: (only taking step 4 and 5 into account)</p>
  
  <pre><code>from("...")
    // here format the message to be sent out
    .to("external_server")
        // what code should I write here ??
        // something like: 
        //     .onException(alwaysDo.class)
        //         .retryWhile(Is200OKandINPROGRESS)
        //         .delay(2000)
        //     .end ()
        // or maybe it should not be here ??
  </code></pre>
  
  <p>I am also a bit confused how the "alwaysDo.class" should look like ??
  Or ... should I use something completely different to solve this orchestration ?
  (I just want to re-transmit as long as I get a 200 OK with INPROGRESS state ...)</p>
  
  <p>Thanks in advance for your help.</p>