title: Why WebFlux doesn't return value immediately as it was produced
body: <p>As I understand, when Spring WebFlux should return the Flux of values, it would print and send values immediately as it was produced. But I have done some tests, and it returns all values only when all are produced (example code is below). Am I doing something wrong, or it is how it should behave and I misunderstood the reactive concept?</p>
  <p><strong>server part</strong>:</p>
  <pre><code>@SpringBootApplication
  public class ReactiveResponseExperimentApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(ReactiveResponseExperimentApplication.class, args);
      }
  
  }
  
  
  @RestController
  @RequiredArgsConstructor
  class ProductController {
  
      private final BobikService bobikService;
  
      @CrossOrigin
      @PostMapping(&quot;/bobiks&quot;)
      @ResponseStatus(HttpStatus.CREATED)
      public Mono&lt;Bobik&gt; createBobik(@RequestBody Bobik bobik) {
          return bobikService.save(bobik);
      }
  
      @CrossOrigin
      @GetMapping(&quot;/bobiks&quot;)
      public Flux&lt;Bobik&gt; getAllBobiks() {
          return bobikService.getAllBobiks();
      }
  
      @CrossOrigin
      @GetMapping(&quot;/bobiks/{id}&quot;)
      public Flux&lt;Bobik&gt; getBobikById(@PathVariable UUID id) {
          return bobikService.getBobikById(id);
      }
  }
  
  @Component
  class BobikService {
  
      private HashMap&lt;UUID, Bobik&gt; dao = new HashMap&lt;&gt;();
  
      public Mono&lt;Bobik&gt; save(Bobik bobik) {
          bobik.setId(randomUUID());
          bobik.setStatus(Status.CREATED);
          dao.put(bobik.getId(), bobik);
          return Mono.just(bobik);
      }
  
      public Flux&lt;Bobik&gt; getAllBobiks() {
          return Flux.fromIterable(dao.values());
      }
  
      public Flux&lt;Bobik&gt; getBobikById(UUID id) {
          Bobik bobik = dao.get(id);
          if (bobik != null) {
              return Flux.create(fluxSink -&gt; {
                  boolean sendingInProgress = true;
                  while(sendingInProgress) {
                      try {
                          Thread.sleep(4000);
                          if (bobik.getStatus() == Status.OPTIMISED) {
                              fluxSink.complete();
                              sendingInProgress = false;
                              System.out.println(&quot;---&gt; sending completed&quot;);
                          } else {
                              bobik.setStatus(Status.values()[bobik.getStatus().ordinal() + 1]);
                              System.out.println(&quot;---&gt; send Bobik with status: &quot; + bobik.getStatus());
                              fluxSink.next(bobik);
                          }
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                          fluxSink.error(e);
                      }
                  }
              });
          }
          return Flux.empty();
      }
  }
  
  @Data
  class Bobik {
  
      private UUID id;
      private String name;
      private Status status;
  
  }
  
  enum Status {
  
      CREATED,
      UPLOADED,
      CROPPED,
      OPTIMISED,
  
  }
  
  </code></pre>
  <p><strong>client part</strong></p>
  <pre><code>    reactBobik() {
          console.debug(`--- going to react with bobik ${this.bobikId}`);
          this.http
              .get&lt;Bobik&gt;(`http://localhost:8080/bobiks/${this.bobikId}`)
              .subscribe(
                  (nextBobik) =&gt; {
                      console.info(`--- next bobik is here with status ${nextBobik.status}`);
                      console.info(nextBobik);
                  },
                  (error) =&gt; {
                      console.error(`error occurred during fetching bobiks`, error);
                  },
                  () =&gt; {
                      console.info(`--- that's all, folks!`)
                  }
              );
      }
  </code></pre>
  <p><strong>server logs</strong></p>
  <pre><code>---&gt; send Bobik with status: UPLOADED
  ---&gt; send Bobik with status: CROPPED
  ---&gt; send Bobik with status: OPTIMISED
  ---&gt; sending completed
  </code></pre>
  <p><strong>client logs</strong></p>
  <pre><code>--- going to react with bobik 079b41eb-ebf3-4d7a-a520-1b9b4bfdae4c
  --- next bobik is here with status undefined
  Array(3) [ {…}, {…}, {…} ]
  --- that's all, folks!
  </code></pre>