返回目录
https://blog.csdn.net/BW_Bear/article/details/88746646
源码位置
微服务注册管理:
https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/microservice-discovery-eureka
生产者:
https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/microservice-provider-user
消费者:
Turbine:
https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/使用消息中间件收集数据/hystrix-turbine-mq
1.改造消费者微服务
1.1 添加依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>sprint-cloud-netflix-hystrix-stream</artifactId>
</dependency>
<!--rabbit 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>sprint-cloud-starter-stream-rabbit</artifactId>
</dependency>
1.2 修改配置文件
添加
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
2.改造Turbine
1.1 添加依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>sprint-cloud-netflix-hystrix-stream</artifactId>
</dependency>
<!--rabbit 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>sprint-cloud-starter-stream-rabbit</artifactId>
</dependency>
1.2 修改配置文件
添加
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
同时删除:
turbine:
app-config: MICROSERVICE-CONSUMER-MOVIE-1,MICROSERVICE-CONSUMER-MOVIE-2
cluster-name-expression: "'default'"