title: How to use Hystrix with Spring WebFlux WebClients?
body: <p>I'm using Spring WebFlux with functional endpoints to create an API. To provide the results I want, I need to consume an external RESTful API, and to do that in a async way I'm using a WebClient implementation. It works well and goes like this:</p>
  
  <pre><code>public WeatherWebClient() {
      this.weatherWebClient = WebClient.create("http://api.openweathermap.org/data/2.5/weather");
  }
  
  public Mono&lt;WeatherApiResponse&gt; getWeatherByCityName(String cityName) {
      return weatherWebClient
              .get()
              .uri(uriBuilder -&gt; uriBuilder
                                  .queryParam("q", cityName)
                                  .queryParam("units", "metric")
                                  .queryParam("appid", API_KEY)
                                  .build())
              .accept(APPLICATION_JSON)
              .retrieve()
              .bodyToMono(WeatherApiResponse.class);
  }
  </code></pre>
  
  <p>As this performs network access, it's a good use case for NetFlix OSS Hystrix. I've tried using spring-cloud-starter-netflix-hystrix, adding @HystrixCommand to the method above, but there's no way to make it trip the circuit, even if I set a bad URL (404) or wrong API_KEY (401).</p>
  
  <p>I thought this could be a problem of compatibility with the WebFlux itself, but setting property @HystrixProperty(name="circuitBreaker.forceOpen", value="true") indeed forces the fallback method to run.</p>
  
  <p>Am I missing something? Is this approach incompatible with Spring WebClients?</p>
  
  <p>Thanks!</p>