title: How to invoke multiple services for a flux / mono in java reactive?
body: <p>I am new to reactive world, might sound a newbee, I have a flux of product having size 20-30, and for each product i need to fetch the below from different microservices:</p>
  <ol>
  <li>average review count</li>
  <li>totalCommentCount</li>
  <li>wishlistedCount</li>
  <li>variants..</li>
  <li>..
  6 ..</li>
  </ol>
  <p>What i have tried..</p>
  <p><strong>1. doOnNext</strong></p>
  <pre><code>Flux&lt;Product&gt; products = ...
  products
  .doOnNext(product -&gt; updateReviewCount)
  .doOnNext(product -&gt; updateTotalCommentCount)
  .doOnNext(product -&gt; updateWishlistedCount)
  .doOnNext(product -&gt; updateVariants)
  ...
  </code></pre>
  <p>This turns out to block the chain for each call for each product..</p>
  <pre><code>e.g.
  Total records(20) * No. of service calls(5) * Time per service calls(30 ms) = 3000ms 
  </code></pre>
  <p><strong>But time will grow with the number of records || number of service calls.</strong></p>
  <p><strong>2. map</strong>
  using map i updated and returned same reference, but the results were same.</p>
  <p><strong>3. collected all as list and executed aggregate query to downstream services</strong></p>
  <pre><code>Flux&lt;Product&gt; products = ...
  products
  .collectList() // Mono&lt;List&lt;Product&gt;&gt;
  .doOnNext(productList -&gt; updateReviewCountOfAllInList)
  .doOnNext(productList -&gt; updateFieldB_ForAllInList)
  .doOnNext(productList -&gt; updateFieldC_ForAllInList)
  .doOnNext(productList -&gt; updateFieldD_ForAllInList)
  ...
  </code></pre>
  <p>This did increase the performance, although now the downstream application has to return more data for a query, so little time increased on downstream side but that's okay.</p>
  <p>Now with this, i was able to achieve time as below...
  Total records(combined as list , so 1) * No. of service calls(5) * Time per service calls(50 ms as time increased) = 250ms</p>
  <p><strong>But time will grow with the number of service calls.</strong></p>
  <p><strong>Now i need to parallelize these service calls</strong> and execute these service calls in parallel and update their respective fields on the same product instance (same reference).
  Some like below</p>
  <pre><code>Flux&lt;Product&gt; products = ... // of 10 products
  products
  .collectList() // Mono&lt;List&lt;Product&gt;&gt;
  .doAllInParallel(serviceCall1, serviceCall2, serviceCall3...)
  
  . // get all updated products // flux size of 10
  </code></pre>
  <p>With that i want to achieve time... 250/5 = 50ms</p>
  <p>How to achieve that?
  I found different articles, but i am not sure on what's the best way to do it? Can someone please help me on the same.</p>