These are chat archives for spring-cloud/spring-cloud

4th
Nov 2018
Dieter Hubau
@Turbots
Nov 04 2018 20:09
I’ve got an issue when trying out HystrixCommands together with the Spring Flux Webclient:
@RequestMapping("/{movieId}")
    public Mono<Movie> findMovie(@PathVariable("movieId") final String movieId) {
        Flux<Recommendation> recommendations = HystrixCommands.from(this.recommendationClient.get()
            .uri(String.format("%s", movieId))
            .retrieve()
            .bodyToFlux(Recommendation.class))
            .fallback(Flux.empty())
            .commandName("find-recommendations")
            .toFlux();

        Mono<Movie> movieMono = HystrixCommands.from(movieClient.get()
            .uri(String
                .format("3/find/%s?external_source=imdb_id&language=en-US&api_key=3c5dc7cf33e70ad798ec4337a7a14605",
                    movieId))
            .retrieve()
            .bodyToMono(Movies.class)
            .map(movies -> movies.getMovies().get(0)))
            .fallback(Mono.just(new Movie("Fallback Movie", Lists.newArrayList())))
            .commandName("tmdb-find-movie")
            .toMono();

        return movieMono.flatMap(movie -> recommendations.map(movie::addRecommendation).last());
    }
Everything works, but the Hystrix Dashboard is showing failures instead of successful calls.. weird