Describe the issue
- Given application-couchdb.yml
file exists in the git repository
- And a config-server is configured to use this git repository.
- And a service (config-client) is running with the profile couchdb
.
- And config-server & service (config-client) both have enabled cloud-bus.
- And Gitlab webhook is configured to notify to the config-server when there is any change in the git repo
- When I update application-couchdb.yml
and push into git repo
- Then the service doesn't refresh its configuration. (ISSUE)
- But, If I update the application.yml
and push into the git repo
- Then the service configuration is updated successfully. This concludes that the cloud-bus configuration/setup is working ok.
Expected result
When I update application-couchdb.yml
and push into git repo; Then the service should refresh it's configuration
Sample Sorry! I am not providing a sample for now. Let me know if it's required.
Cause
I tried to debug the issue; and found that the RemoteRefreshApplicationEvent.destination
isn't set properly in this case. It sends a notification for this git change on destination = *:couchb
(more precisely *:couchdb:**
).
As spring.cloud.bus.id
of the service (config-client) is service1:80:f2a50a0b35cf65a764eec93d51431693
it doesn't match with the destination described in the event.
Suggested Fix
PropertyPathEndpoint.guessServiceName
should be updated. It shouldn't use profile
in the serviceName. So, In this case the serviceName built by it should be *
instead of *:couchdb
.
In another scenario where user-couchdb.yml
was changed, ServiceName should be user
instead of user:couchdb
.
Comment From: spencergibb
Maybe add an option to not include the profile.
Comment From: ThomasVitale
I experienced the same issue. Currently, as a workaround, I considered setting spring.cloud.bus.id=${spring.application.name}:${spring.profiles.active}
in case only one profile is active. If more profiles are enabled, it won't work.
I'm available to help fix this issue.
Comment From: ryanjbaxter
Duplicate of #2120 2138