title: How to check Flux<Object> is empty or not?
body: <p>I have a api for kubernetes to call and detect service is available or not.In the api,first call a interface to get host of other service,the interface return a Flux,if the result is empty api return SERVICE_UNAVAILABLE other return ok.My current code as below:</p>
  <pre class="lang-java prettyprint-override"><code>@GetMapping(value = &quot;/gateway/readiness&quot;)
  public Mono&lt;Long&gt; readiness(ServerHttpResponse response) {
      Flux&lt;Map&lt;String, List&lt;String&gt;&gt;&gt; hosts = hostProvider.getHosts();
      List&lt;String&gt; hostProviders = new ArrayList&lt;&gt;();
      
      // the below code has a warning: Calling subscribe in a non-blocking scope
      hosts.subscribe(new Consumer&lt;Map&lt;String, List&lt;String&gt;&gt;&gt;() {
          @Override
          public void accept(Map&lt;String, List&lt;String&gt;&gt; stringListMap) {
              hostProviders.addAll(stringListMap.keySet());
          }
      });
      if (hostProviders.isEmpty()) {
          response.setStatusCode(HttpStatus.SERVICE_UNAVAILABLE);
      }
      return routeLocator.getRoutes().count();
  }
  </code></pre>
  <p>Has graceful to do this?</p>