局部刷新
某些场景下(例如灰度发布),我们可能只想刷新部分微服务的配置,此时可通过/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/