spring-cloud / spring-cloud-bus

Spring Cloud event bus
http://cloud.spring.io/spring-cloud-bus/
Apache License 2.0
409 stars 242 forks source link

ServiceMatcher does not take spring.cloud.config.name property into account #132

Closed dl1ely closed 5 years ago

dl1ely commented 6 years ago

The spring.cloud.config.name property can be used in spring-cloud-config-client to change the service name to be used to query configuration from the Config Server. But when using spring-cloud-config-monitor on the Config Server, the destination service of the RefreshRemoteApplicationEvent is set to the service name derived from the config file that has changed. A service with spring.application.name: X can fetch file Y.yml from the Config Server by setting spring.cloud.config.name: Y. But if Y.yml gets changed, the destination Service is set to Y by config server, and the ServiceMatcher class of spring-cloud-bus matches this against spring.application.name only, so the change to Y.yml does not trigger the config refresh as expected, because the spring.application.name does not match Y.

This was first reported in https://github.com/spring-cloud/spring-cloud-config/issues/1141, i also open an issue here by request, because one possible solution is to take spring.cloud.config.name in account in ServiceMatcher.

dl1ely commented 5 years ago

I'll provide a PR soon, most likely today.