title: Conditional repeat or retry on Mono with webclient from Spring WebFlux
body: <p>What i want to do is a conditional repeat on a Mono in Webflux with webclient.The Situation is the following:</p>
  
  <p>We have some business rest service service that returns a generated document. the generation of this document is triggered from another service that gets called before this one. But, back to business: the document generation service needs from 10-30 seconds. What we want to do is: check after 10 seconds if document (Mono) is generated. If so, all is fine. If not, repeat (or retry) after another 5 seconds and check if document is generated. And so on until (worst case) a timeout after 30 seconds. Is this possible? Some (pseudo) code:</p>
  
  <pre><code>return this.webClient.post().uri(SERVICE_URL)).        
  body(BodyInserters.fromObject(docRequest)).retrieve().
  bodyToMono(Document.class).
  delaySubscription(Duration.ofSeconds(10)).
  repeat5TimesWithDynamicTimeDelayUntil(!document.isEmpty()).
  subscribe();
  </code></pre>
  
  <p>Greetz
  Bernardo </p>