添加消息总线RabbitMQ支持

<!--添加消息总线RabbitMQ支持-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>

服务配置中心 配置文件

#rabbitmq相关配置
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
##rabbitmq相关配置,暴露bus刷新配置的端点
management:
endpoints: #暴露bus刷新配置的端点
web:
exposure:
include: 'bus-refresh'

生产者服务端配置文件

#rabbitmq相关配置 15672是Web管理界面的端口;5672是MQ访问的端口
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest

# 暴露监控端点
management:
endpoints:
web:
exposure:
include: "*"

测试

SpingCloud Bus总线_分布式


SpingCloud Bus总线_spring cloud_02


SpingCloud Bus总线_分布式_03