I want to use dynamic and central configuration strategy for my microservices (MS) (multiple instances of same type having same configuration) and I'm using Azure App Configuration (AAC). I want to minimize calls to AAC so when one MS is starting I would like to read configuration from AAC and keep that until changes made i.e I dont want for every call to Configuration["Env:service:some-param"] generate calls to AAC. The notification part I have solved via eventgrid and servicebus-events so all MSs reaches notification that changes have been made but I really cant find any good solution to force to reload Configuration from AAC on demand.
In Program.cs I hook up AAC via:
config.AddAzureAppConfiguration(options =>
options
.Connect(connection)
.ConfigureRefresh(refresh =>
{
refresh.Register(environment + ":" + service + ":<Some-param>",true)
.SetCacheExpiration(TimeSpan.FromDays(1));
_environmentRefresher = options.GetRefresher();
})
why I set SetCacheExpiration(TimeSpan.FromDays(1)) is because I dont want to make unnecessary calls to AAC and I thought that if I fetch the refresher and triggers it when event occurs configuration would be reloaded but thats seems not to be the case due to SetCacheExpiration seems to override everything so my question is ... Is given scenario not solvable in .net core or can I achieve this in some way?
question from:
https://stackoverflow.com/questions/65599039/force-update-configuration-using-azure-app-configuration 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…