I am a very much new to Netflix archaius. I have a code snippet which reads Java property file and prints property value.
When this program runs it prints the value of property named "Fields" from testproperty.properties file. Now while this program is running I am updating the value of "Fields" property, so archaius should fetch change value dynamically. But it is still printing older value.
What is the correct way to use archaius with this Java Program? Or to update properties in a program without restarting it ? If someone can point out correction in this code snippet it would be helpful.
I want to run a demo with Netflix archaius, so I have imported archaius through maven in my project.
Now I am updating my properties file. But still it prints the old property value. (P.S.: I have kept the continuous while loop in driver program to see if archaius picks the update property value runtime. I guess that's what archaius suppose to do. Fetching the updated property without restarting application. Correct me if I am wrong.)
Below is my code snippet :
import com.netflix.config.DynamicPropertyFactory;
import com.netflix.config.DynamicStringProperty;
public class PropertyChangetest {
public static void main(String args[]) {
DynamicPropertyFactory sampleProp = DynamicPropertyFactory.getInstance();
System.setProperty("archaius.configurationSource.defaultFileName", "TestProperty.properties");
System.setProperty("archaius.fixedDelayPollingScheduler.delayMills", "500");
while(true) {
DynamicStringProperty sampleProp1 = sampleProp.getStringProperty("fields","");
System.out.println(sampleProp1.get());
}
}
}
My "TestProperty.properties" file only have one property called fields. After running the program, I am updating my property file but it still prints older value.