SpringCloud-Spring Cloud Config-局部刷新

本文介绍如何通过Spring Cloud Bus实现局部配置刷新。特别是在灰度发布等场景中,可以通过指定destination参数来定位并仅刷新特定微服务的配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

局部刷新

某些场景下(例如灰度发布),我们可能只想刷新部分微服务的配置,此时可通过/bus/refresh端点的destination参数来定位要刷新的应用程序。

例如: /bus/refresh?destination=customers:9000 ,这样消息总线上的微服务实例就会根据destination参数的值来判断是否需要要刷新。其中, customers:9000 指的是各个微服务的ApplicationContext ID。

destination参数也可以用来定位特定的微服务。例如: /bus/refresh?destination=customers:** ,这样就可以触发customers微服务所有实例的配置刷新。

 

扩展阅读:关于ApplicationContext ID

默认情况下,ApplicationContext ID是spring.application.name:server.port,详见 org.springframework.boot.context.ContextIdApplicationContextInitializer.getApplicationId(ConfigurableEnvironment) 方法。

http://www.itmuch.com/spring-cloud-code-read/spring-cloud-code-read-spring-cloud-bus/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值