Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring cloud config git refreshRate behaviour

I am trying to setup Spring Cloud Config Server and want to enable auto refresh of properties based on changes to the backing git repository.

Below is the bootstrap.yml of the server.

server:
  port: 8080

spring:
  application:
    name: my-configserver
  cloud:
    config:
      server:
        bootstrap: true
        git:
          uri: /Users/anoop/Documents/centralconfig
          refreshRate: 15
          searchPaths:  {application}/properties
    bus:
      enabled: true

As per the documentation spring.cloud.config.server.git.refreshRate determines

how often the config server will fetch updated configuration data from your Git backend

I see that the config clients are not notified of changes, when the configuration changes. I have not configured a git hook for this and was hoping that just setting the property would do the job.

Anoop

like image 728
Anoop Avatar asked Nov 07 '22 19:11

Anoop


1 Answers

Since you have configured the refreshRate property, whenever config client (other applications) call config server to fetch properties (this happens when either the application starts or application calls /actuator/refresh endpoint), they will get properties which were fetched 15 seconds (your refreshRate) old.

By default the refreshRate property is set to 0, meaning any time client applications ask for property config server will fetch latest from GIT.

I don't think there is any property which lets your client apps get notified in case of change/commits in the GIT. This is something your app needs to do by calling actuator/refresh endpoint. This can be done programmatically using some scheduler (though I wouldn't recommend that).

like image 59
Sarvesh Dubey Avatar answered Dec 08 '22 21:12

Sarvesh Dubey