title: Project reactor: repeat service call and collect response results until condition met
body: <p>Greetings venerable SO community...</p>
  <p>I come to everyone today in need of a reactive solution for a problem I've not yet encountered.
  I would still consider myself a reactive neophyte at this point, and although I've been reading over &quot;Hands On Reactive Programming in Spring&quot; I've still got the boss looking over me and tapping his foot if you know what I mean, so I'm again hoping that some benevolent and brilliant soul might point me in the right direction for an implementation I'm presently tasked with.</p>
  <p>Here's the situation:
  I have to call an external service providing a list of transactions(containing transaction data) for a given date range.
  In addition to the date range being passed in the request to the external service, there's also number of transactions per page, we'll call &quot;N&quot;, and page number, we'll call &quot;P.&quot;</p>
  <p>So say for a certain date range there is a total of 23 transactions.</p>
  <p>Then:</p>
  <ul>
  <li>For N=10 and P=1 they will return 10 transactions, from 1-10</li>
  <li>For N=10 and P=2 we’d get transactions 11-20.</li>
  <li>For N=10 and P=3 we’d get transactions 21-23.</li>
  <li>For N=10 and P=4 or higher no transactions would be returned.</li>
  <li>For N=7 and P=3 we’d get transactions 15-21.</li>
  <li>For N=30 and P=1 we’d get all 23 transactions and know that we have all of the transactions because the number returned is less than number requested.</li>
  </ul>
  <p>(Please note, we have no idea how many transaction records in total will ultimately be returned.)</p>
  <p>So what I'm after is some sort of reactive construct that can potentially repeatedly call the remote transaction list service, check if the total number returned is less than the total number requested, and if not, call again while saving up/accumulating all the records in another list, and then once we reach the end, send this other list of all the transactions back in a response to the service that invoked this code.</p>
  <p>Does this make sense, or no?</p>
  <p>I've been searching SO, and so far I found <a href="https://stackoverflow.com/questions/54220147/reactor-how-to-repeat-some-step-n-times-if-condition-is-met">this</a> article that seems somewhat applicable and promising using the &quot;repeat&quot; functionality, but I'm really not sure if this is the right path or not.</p>
  <p>I also found <a href="https://stackoverflow.com/questions/64105604/how-to-repeat-or-retry-conditionally-with-reactor">this</a> article which also seems like it might be relevant.</p>
  <p>Again, and as always, any and all help/guidance here is immensely appreciated!</p>