springcloud微服务学习笔记57:Bus动态刷新全局广播配置实现
一:给cloud-config-center-3344配置中心服务端添加消息总线支持
1.pom
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>

2.yml
server:
port: 3344
spring:
application:
name: cloud-config-center
cloud:
config:
server:
git:
#uri: git@github.com:EiletXie/config-repo.git #Github上的git仓库名字
uri: https://github.com/EiletXie/config-repo.git
##搜索目录.这个目录指的是github上的目录
search-paths:
- config-repo
##读取分支
label: master
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
eureka:
client:
service-url:
defaultZone: http://eureka7001.com:7001/eureka/
#rabbitmq相关设置 ,暴露 bus刷新配置的端点
management:
endpoints:
web:
exposure:
include: 'bus-refresh'
二.给cloud-config-center-3355客户端添加消息总线支持
1.pom

2.yml

三.给cloud-config-center-3366客户端添加消息总线支持
1.pom

2.yml

四.测试
1.运维工程师
修改Github上配置文件增加版本号
发送POST请求
curl -X POST “http://localhost:3344/actuator/bus-refresh”

2.配置中心
http://config-3344.com:3344/config-dev.yml
3.客户端
http://localhost:3355/configInfo
http://localhost:3366/configInfo


浙公网安备 33010602011771号