Rahul Vedpathak
Rahul Vedpathak

Reputation: 1436

How to refresh config clients automatically?

I am new to Spring Config Server/Client technologies. I am using a spring config server to hold some config values. Config clients will connect to the server and get the values.

If i change some of the config values at the config server, then currently I have to refresh the clients to load the config details from config server again by invoking "/refresh" on each client.

Is there anyway the clients will be notified by the config server and they will then reload the configuration again ?

Upvotes: 1

Views: 1628

Answers (1)

Tatenda Zifudzi
Tatenda Zifudzi

Reputation: 651

Yes there is a way.

The solution is to use the Spring Cloud Bus. Using this module, you would link multiple clients to the server using a message broker. The only message broker implementation currently supported by this module is AMQP. Once the clients are connected to the server, invoking the endpoint on the server /bus/refresh will automatically broadcast the configuration changes to all the subscribed clients. This therefore means it is possible to reload configuration changes for any number of clients with one single refresh request which originates at the server.

Upvotes: 1

Related Questions