archaius
archaius copied to clipboard
2.x polled dynamic properties for typesafe
In 1.x, we have a generic scheduler that can be configured with any PolledConfigurationSource, like TypesafeConfigurationSource to achieve dynamic properties :
FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 10, false);
TypesafeConfigurationSource typesafeSource = new TypesafeConfigurationSource() {
@Override
protected Config config() {
return ConfigFactory.parseResourcesAnySyntax("override");
}
};
DynamicConfiguration configuration = new DynamicConfiguration(typesafeSource, scheduler);
DynamicPropertyFactory.initWithConfigurationSource(configuration);
However, I don't see such a dynamic property implement for Typesafe in 2.x. As per the documentation, PollingDynamicConfig is supposed to be used, but I don't see any polling support provided in the TypesafeConfigReader, only URLConfigReader supports polling. In 2.x, is dynamic property supported for URL based properties only ?
URLConfigReader implements Callable<PollingResponse>
If am missing something, can someone kindly provide an 2.x example how I can achieve dynamic config using typesafe ?