Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud Configuration - auto-enable Refresh Endpoint & Git monitoring

Questions

I am starting to learn Spring Cloud starting with Spring Config. There are two basic questions as I have to get me onto the next step in my learning process (moving on to Service Discovery via Consul).

  1. How do I auto-enable the /refresh endpoint to POST to?
  2. Is there a way to automatically monitor for updates in Git?

For #1 I implemented my own @RestController/@RequestMapping but none of the tutorials I was following mentioned that. I checked my Maven configuration and it matches what the samples were providing but it's not popping up.

I found a post for the second question here: spring cloud auto refresh config server property. I was just wondering if there were any updates since November 2015 on this.

Both of these things seem to be exceedingly handy and will be directly intertwined with my Consul learning as I can push configuration updates automatically to everyone that is registered as a service. Once I get there I can work on the restarts too, but that is later.

Updates

I got an answer to #1. I had botched my dependencies configuration in my Maven module. After triple-checking the configuration it turns out it was just pilot error. Still working on #2, though - if anyone has any updates it would be appreciated.

like image 764
el n00b Avatar asked Sep 05 '16 18:09

el n00b


2 Answers

For #1, Spring cloud config intrdouced the @RefreshScope annotation which will expose the /refresh endpoint (over HTTP or JMX)

For #2, after '/refresh', spring cloud config will take the latest git commit, For the config changes, essentially there are two ways, 1) pull the changes 2) push the changes, spring cloud bus approach is based on the rabbitmq to push the config chagnes.

Reference

Refresh Scope

like image 193
Liping Huang Avatar answered Oct 05 '22 08:10

Liping Huang


For GIT updates try to go through this documentation spring-cloud-config-push-notifications and do not forget to install ngrock. Also if you just need to refresh on git commit then you do not even need cloud-bus project just config should be enough. Hope this helps.

like image 30
Grinish Nepal Avatar answered Oct 05 '22 09:10

Grinish Nepal