无法在 Spring Cloud 中获取/hystrix.stream [英] Unable to get /hystrix.stream in Spring Cloud

查看:32
本文介绍了无法在 Spring Cloud 中获取/hystrix.stream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有以下 Spring Cloud 版本 Camden.SR2 依赖项的微服务.春季启动 1.4.1.http://localhost:8080/hystrix.stream 没有响应.

I have created a microservice with following dependencies of Spring cloud version Camden.SR2. Spring Boot 1.4.1. http://localhost:8080/hystrix.stream is not responding.

如果我将 Spring Cloud 版本设为 Brixton.*(RELEASE, SR1,...),我只会在浏览器中得到 ping: 作为回复.>

If I make the Spring Cloud version as Brixton.*(RELEASE, SR1,...), I get only ping: as reply in browser.

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-hystrix</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

application.properties

application.properties

spring.application.name=sample-service
server.port = 8080

申请

@SpringBootApplication
@EnableCircuitBreaker
public class SampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(SampleApplication.class, args);
    }
}

推荐答案

在 Spring Boot 1.5.x 中 Hystrix.stream 只会在实际执行的调用中显示数据,并且使用 @HystrixCommand

In Spring Boot 1.5.x Hystrix.stream will only show data if there are actually call's being executed that are annotated with @HystrixCommand

如果您注释一个方法,它会在使用时将数据发布到流中.

If you annotate a method it will publish data to the stream when its being used.

更多信息:http://cloud.spring.io/spring-cloud-static/Brixton.SR6/#_circuit_breaker_hystrix_clients

这篇关于无法在 Spring Cloud 中获取/hystrix.stream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆