我使用的是spring boot 1.3.1和spring cloudl Brixtom.M4,在使用spring boot 1.3.1.时,我发现Turbine AMQP项目不再可用,而我们现在有spring Turbine Stream项目。我想用rabbitmq或kafka来使用SpringTurbine,并想监控在Zuul中注册的所有路由的hystrix流,我可以看到Zuul的hystrix.stream,也可以在hystrix仪表板中看到,但不确定如何使用SpringTurbine流。在网上,我找到了使用涡轮机AMQP的代码和文档。
我有zuul服务器运行广告http://localhost:9003/与离职
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
和main.java作为
@SpringBootApplication
@EnableZuulProxy
@EnableCircuitBreaker
public class EdgeServerApplication {
public static void main(String[] args) {
SpringApplication.run(EdgeServerApplication.class, args);
}
}
我还有springTurbinestream项目作为
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
org.springframework.boot弹簧套启动器执行器
以及作为的TurbineStream的主要类别
@SpringBootApplication
@EnableTurbineStream
@EnableDiscoveryClient
public class WiziqTurbineApplication {
public static void main(String[] args) {
SpringApplication.run(WiziqTurbineApplication.class, args);
}
}
当我运行应用程序并转到http://localhost:9003/hystrix.stream我看到小溪,但如果我去http://localhost:9003/turbine.stream它出错了。
我做错了什么?
您的客户端应用程序(在端口9003上)不应该有/turbine.stream
。它应该向rabbit发送带有hystrix度量的消息(例如)。要做到这一点,您需要添加spring-cloud-netflix-hystrix-stream
和spring-cloud-starter-stream-rabbit
(就像您在服务器上为*-turbine-*
依赖项所做的那样)。