Giter Site home page Giter Site logo

archaius's People

Contributors

akang31 avatar asibross avatar brharrington avatar carl-mastrangelo avatar codegass avatar dandew avatar drtechniko avatar elandau avatar gavinbunney avatar gdespres avatar gorzell avatar howardyuan avatar jhspaybar avatar jkschneider avatar jlisam avatar jonathanbond avatar kilink avatar noel-yap avatar qiangdavidliu avatar rahulsom avatar rgallardo-netflix avatar rpalcolea avatar rspieldenner avatar shanman190 avatar smadappa avatar spencergibb avatar tcellucci avatar twicksell avatar younver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archaius's Issues

Support loading of contextual properties from designated properties file

With contextual property, it is possible to have property value determined by context. And the added benefit is that the all property values and corresponding scopes and priorities are defined in one place. This is better than loading cascaded properties file.

The proposal is to have an new API in ConfigurationManager that loads a properties file containing only contextual property. By doing that we can determine the properties value at load time if possible or at least validate the syntax of the property definition.

archaius.dynamicPropertyFactory.registerConfigWithJMX doesn't appear to be working

I wanted to setup Archaius with JMX enabled by default for controlling the configuration, though my config.properties appears to be loading correctly and the values appear set there is no MBean registered and visible with JConsole.

I have setup an example IntelliJ project for testing this, the logs are in the readme showing its definitely picking up the correct values. That's over here:

https://github.com/chriswhitcombe/ArchaiusTest

I can programmatically register an MBean and that works ok, its just the defaulting it on that doesn't work.

Support comment to contextual property

There is a suggestion to support comment for each possible value and its scopes of contextual property.

It seems that the easiest way is to add a comment field in DynamicContextualProperty.Value.

Add ability to change dynamic property value based on context

Currently dynamic property can change value based on changes in configuration and changes in deployment context. There is a need to further extend this capability to make the property value change based on other context at runtime like user input. For example, a web application may want certain dynamic property value changed based on one or more parameters in the http request.

The current proposal consists of the following component:

  • A JSON blob that defines the possible property values and conditions under which each property value should be applied. Here is an example of such JSON blob:
[
    {
       "dimensions":  
              {"d1":["v1","v2"]},
       "value":5
    },
     {
        "dimensions":
             {"d1":["v3"],"
               d2":["x1"]
             },
        "value":10
     },
    {
        "value":2
    }
]

This blob means that

If dimension "d1" has value of either "v1" or "v2", the value of the property is integer 5;
Else if dimension "d1" has value "v3" and dimension "d2" has value "x1", the value of the property is 10;
Otherwise, the value of the property is 2

  • A predicate that takes a Map<String, Collection<String>>(corresponds to "dimensions" in the above example) and determine if the current runtime context matches the condition described in the Map.
  • A sub class of PropertyWrapper<T> that takes the above two components and returns the dynamic value in its getValue() method. Assuming each element in the JSON array above is of type Value, the getValue() can be implemented as:
    @Override
    public T getValue() {        
        if (values != null) {
            for (Value<T> v: values) {
                if (v.getDimensions() == null || v.getDimensions().isEmpty()
                        || predicate.apply(v.getDimensions())) {
                    return v.getValue();
                }
            }
        }
        return defaultValue;
    }

Cannot get archaius property validation to work

I cannot understand how the validation for archaius works, as I expect the following code to run my ProperyChangeValidator.

How do you setup a validation for a property in order for the values to follow some invariants.

        DynamicStringSetProperty values = new DynamicStringSetProperty("viva", (Set<String>) null, ";");
        Set<String> v1 = values.get();
        for (String v : v1) {
            System.out.println(v);
        }

        DynamicIntProperty p = DynamicPropertyFactory.getInstance().getIntProperty("viva2", 12);
        p.addValidator(new PropertyChangeValidator() {

            public void validate(final String newValue) throws ValidationException {
                if (StringUtils.equals(newValue, "24")) {
                    throw new ValidationException("cannot be 24");
                }
            }
        });

        while (true) {
            System.out.println(p.get());
            Thread.sleep(1000);
        }

'Watch' a set of properties

Hello!

I'm new to Archaius, but I'm hoping to adopt it in our apps in the near term. But, I've got some questions, and I couldn't figure out a different channel to ask them on, so please pardon me asking this via an 'issue'.

I'm trying to figure out how I can react to changes on a SET of properties all at once, but only once per file update. Now, I haven't actually tried this (in 'real' code, nor in a unit test), but I did look at the source a bit.

Let's say I have a DataSource that I want to update when any or all of the following 3 properties change:
db.username=value1
db.password=value2
db.url=value3

I know I can set up a Callback per each of the properties set. But, my concern is that when I make a change at runtime to more than one of those properties, I'll get the corresponding number of Callbacks, potentially performing some long-running update for each Callback.

I'd like to get only ONE Callback for the entire set.

I thought about adding an aggregate property like so:
db.property.set=${db.username};${db.password};${db.url}

But, I was concerned that if I added a Callback watching "db.property.set" I might still get my corresponding Callback called more than once.

I am totally open to the possibility that I am I thinking about this all wrong. ;-) So, any guidance would be appreciated.

PS. I also noted that in DynamicProperty.notifyCallbacks() you've made sure the isolate the code from exceptions, but not long-running callbacks. I'm sure you don't want to add more threads than necessary, but maybe some guidance in the Javadoc that the Callbacks should be short-lived themselves?

Plugging archaius-aws?

A lot of the netflix OSS (if not all) use archaius for configuration. However they mostly don't use dynamodb.
Is it possible to plug my dynamodb-table to projects using archaius-core but not aws without editing the source code of those projects (for instance, just put the archaius-aws in the source path and modify config.properties to tell it to use dynamodb)?

Build breaks because FindBugs reports warning on scala sample library

Here is the summary of the report:

Bad practice Warnings

Code Warning
Nm The class name com.netflix.archaius.samplelibrary.ExampleScala$delayedInit$body doesn't start with an upper case letter
Bug type NM_CLASS_NAMING_CONVENTION (click for details)
In class com.netflix.archaius.samplelibrary.ExampleScala$delayedInit$body
At ExampleScala.scala:[lines 9-19]

Malicious code vulnerability Warnings

Code Warning
EI com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$_args() may expose internal representation by returning ExampleScala.scala$App$$_args
Bug type EI_EXPOSE_REP (click for details)
In class com.netflix.archaius.samplelibrary.ExampleScala
In method com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$_args()
Field com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$_args
At ExampleScala.scala:[line 9]

EI2 com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$args$eq(String[]) may expose internal representation by storing an externally mutable object into ExampleScala.scala$App$$_args
Bug type EI_EXPOSE_REP2 (click for details)
In class com.netflix.archaius.samplelibrary.ExampleScala
In method com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$args$eq(String[])
Field com.netflix.archaius.samplelibrary.ExampleScala.scala$App$$_args
Local variable named x$1
At ExampleScala.scala:[line 9]

For a short term solution, the FingBugs warning will be ignored for archaius-samplelibrary.

Wrong logger in DynamoDbDeploymentContextTableCache

WIthin the Dynamo implementation, the LoggerFactory is setup incorrectly with the wrong class.

public class DynamoDbDeploymentContextTableCache extends AbstractDynamoDbConfigurationSource {

private static Logger log = LoggerFactory.getLogger(AbstractPollingScheduler.class);

@<blah> Context Properties don't actually work with interpolation

It seems that the only time @* context values are properly added to the configuration when the DeploymentContext setter is called.

As a result they cannot currently be used in conjunction with the @next method of chaining property files.

The unit test

    public void testLoadCascadedProperties() throws Exception {

in ConfigurationManagerTest does pass because it call ConfigurationManager.setContext after a config instance has been loaded.

Add support to load application properties that override library properties

Currently library properties are usually loaded by ConfigurationManager.loadCascadedProperties(). Because there is no guarantee of the order of the configurations added, it is hard for application to load override properties.

Therefore, the following API will be provided

ConfigurationManager.loadAppOverrideProperties(String rootResourceName)

which will load the named properties using loadCascadedProperties() into Configuration to be added to ConcurrentCompositeConfiguration after the configuration which holds the system properties. If the installed configuration is not an instance of AggregatedConfiguration, it will simply delegate to loadCascadedProperties().

Spring integration for Archaius

How would one go about integrating this library with Spring? Would I just need to create a org.springframework.beans.factory.config.PropertyPlaceholderConfigurer that gets properties from a Archaius configuration source?

Would I do something like:

  • Configure a WatchedConfigurationSource or PolledConfigurationSource (either in Java or with Spring )
  • Pass it to an "ArchaiusPropertyPlaceholderConfigurer"
  • Use Spring properties like normal e.g., "${foo}"

DynamicPropertyFactory doesn't allow me to clear the underlying ConfigurationSource between test runs

the first test passes, but subsequent tests fail with the following:

java.lang.IllegalStateException: DynamicPropertyFactory is already initialized with a diffrerent configuration source: com.netflix.config.ConfigurationBackedDynamicPropertySupportImpl@8691dee
at com.netflix.config.DynamicPropertyFactory.initWithConfigurationSource(DynamicPropertyFactory.java:254)

am i missing something? not sure how the archaius-core unit tests are passing...

one posisble fix is to add an @VisibleForTesting method to clear the source (and unregister the listeners) - otherwise, modify the code to allow the ConfigurationSource to be set multiple times with a WARN.

Lack of setter overrides in ConfigurationBasedDeploymentContext

Because the setter's aren't overriden, changes made using them can be masked.

The getters will return a property if one exists, but the setters in super only update an internal map so if you set something that has an existing property the change will be hidden.

The override setters should be created and they should set the property in the configuration in addition to calling super.set*

DynamicPropertyUpdater not working correctly with delimiter parsing enabled

With delimiter parsing enabled (which seems to be the default), the DynamicPropertyUpdater doesn't work as expected when the property is a "list" (e.g. "a, b, c") that hasn't changed.

addOrChangeProperty() performs an equals() comparison before propagating the new property to the underlying configuration, however it's comparing an CopyOnWriteArrayList (which is the result of the delimiter parsing) with the String that just got passed in (e.g. "a, b, c" again).

I briefly looked into how that could be fixed but with my still limited knowledge of the framework, I didn't come to any good solution. IMHO, the DynamicPropertyUpdated would either need to understand if the underlying configuration has delimiter parsing enabled or there needs to be functionality on the configuration for turning the string into the list if parsing is enabled, so that the equals comparison succeeds again.

Using Dynamo DB for Deployment Context with archaius

I would like to know what typically would be the Dynamo DB table structure for using deployment context based properties...For e.g
I have a uniqued ID is "id" as primary key in a dynamoDB table and then I want to have different values for attributes say a1, a2 , a3, a4...for each deployment context.
My deployment context can say have values "test", "prod", "stage" ...

As i understand the Dynamo DB should look something like this...

ID deploymentContext a1 a2 a3 a4

1 "test" t11 t12 t13 t14
2 "stage" s11 s12 s13 s14
3 "prod" p11 p12 p13 p14

Here ID would be primary key and deploymentContext would be the range key and the code(as i understand) should look something like this

ArrayList attributeDefinitions = new ArrayList();

attributeDefinitions.add(new AttributeDefinition().withAttributeName("ID").withAttributeType(ScalarAttributeType.S));
attributeDefinitions.add(new AttributeDefinition().withAttributeName("deploymentContext" ).withAttributeType(ScalarAttributeType.S));

        KeySchemaElement key= new KeySchemaElement().withAttributeName(keyAttributeName.get()).withKeyType(KeyType.HASH);
        KeySchemaElement range= new KeySchemaElement().withAttributeName(contextKeyAttributeName.get()).withKeyType(KeyType.RANGE);

        ArrayList<KeySchemaElement> ks= new ArrayList<KeySchemaElement>();
        ks.add(key);
        ks.add(range);

CreateTableRequest req = new CreateTableRequest().withTableName(tableName.get()).withKeySchema(ks).withProvisionedThroughput(output);
req.setAttributeDefinitions(attributeDefinitions);
dbClientForCreatingTable.createTable(req);

... And then code to populate a1 a2 a3 a4 in the table.

However when i use archaius to load such a table it throws an exception in DynamoDbDeploymentContextTableCache::loadPropertiesFromTable at line 255 while deciphering the value of enum from contextKeyAttributeName.get()).getS() where contextKeyAttributeName.get()).getS() is getting evaluated to either "test", "prod" or stage e.t.c depending on value stored in DynamoDB.

May i know what is going wrong with my assumptions regrading how archaius uses dynamoDb vis a vis deployment context.

Provide API to clear callbacks

I discovered in some smoke tests that bang very very heavily on some specialized fast properties that memory was slowly getting clogged. After a heap dump, culprit appears to be the callbacks in PropertyWrapper are getting filled up and there's no way to clear them.

See "protected PropertyWrapper(String propName, V defaultValue)"

Keep successful build artifacts in Cloudbees

The master branch is built by Jenkins here:
https://netflixoss.ci.cloudbees.com/job/archaius-master/

... but it does not keep build artifacts from the latest successful build. Asgard, Edda and Eureka do:
https://netflixoss.ci.cloudbees.com/job/asgard-master/

Being able to download the successfully built WAR makes getting started with Archaius much easier.

Also, where is the mailing list for Archaius? I don't see it listed on the wiki like other projects... e.g.
https://groups.google.com/forum/#!forum/eureka_netflix

Thanks.

Lost on DynamoDB and DeploymentContext

I've been trying to figure out how DynamoDB should work together with the DeploymentContext and so far I couldn't make much sense of what I found.

DynamoDbDeploymentContextConfigurationSource clearly states that the contextKey can be null to pick up global properties. Those properties would have to come from an instance of DynamoDbDeploymentContextTableCache - it's used by DynamoDbDeploymentContextConfigurationSource to retrieve the properties from DynamoDB.

When I look at DynamoDbDeploymentContextTableCache#loadPropertiesFromTable, it clearly looks as if it can handle situations where contextKey is null which would be the prerequisite for the above mentioned support for global properties.

Now, here's my problem: in order for that to work, contextKey cannot be the range key for the table as described in the Wiki - rangeKeys may not be null. Removing the range key doesn't work either because then I cannot have multiple entries for the same key in the table.

Can any of you share how this is supposed to work? Unfortunately, the Wiki doesn't seem to match the current version of the code either because it doesn't even refer to any of the mentioned classes.

Thanks

Add support for DynamicByteArrayProperty

is this something that has been discussed and purposely not added?

also, we need to make sure this can be properly displayed in a JMX viewer - similar to the other properties.

NPE in polling thread

2012-09-12 13:42:22,153 -0700 ERROR [hostId=nite-ftsearch-1] [module=STREAM] [logger=com.netflix.config.DynamicProperty] [thread=pollingConfigurationSource] Error in DynamicProperty callback
java.lang.NullPointerException
at com.netflix.config.DynamicProperty.notifyCallbacks(DynamicProperty.java:484)
at com.netflix.config.DynamicProperty.updateProperty(DynamicProperty.java:532)
at com.netflix.config.DynamicProperty.access$500(DynamicProperty.java:58)
at com.netflix.config.DynamicProperty$DynamicPropertyListener.setProperty(DynamicProperty.java:569)
at com.netflix.config.ExpandedConfigurationListenerAdapter.configurationChanged(ExpandedConfigurationListenerAdapter.java:142)
at com.netflix.config.ConcurrentMapConfiguration.fireEvent(ConcurrentMapConfiguration.java:305)
at com.netflix.config.ConcurrentCompositeConfiguration$1.configurationChanged(ConcurrentCompositeConfiguration.java:156)
at com.netflix.config.ConcurrentMapConfiguration.fireEvent(ConcurrentMapConfiguration.java:305)
at org.apache.commons.configuration.AbstractConfiguration.clearProperty(AbstractConfiguration.java:502)
at com.netflix.config.AbstractPollingScheduler.deleteProperty(AbstractPollingScheduler.java:169)
at com.netflix.config.AbstractPollingScheduler.populateProperties(AbstractPollingScheduler.java:124)
at com.netflix.config.AbstractPollingScheduler$1.run(AbstractPollingScheduler.java:197)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

make commons-configuration optional

I'd like to be able to employ archaius without pulling in commons configuration and its dependencies: https://commons.apache.org/configuration/dependencies.html

For example, in jclouds we only use guice and rocoto. I'd like to be able to have the dynamic equivalent of Names, for example, and I don't think it is necessary to route through commons-config to write a plugin like this:

http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/name/Names.htm

Not possible to have multiple deployment aware entries for a property in DynamoDB

With the contextKey being the rangeKey, it doesn't seem to be possible to have multiple entries for the same ContextKey.

Example:

Item A
key = test
contextKey = region
contextValue = us
value = test value

Item B
key = test
contextKey = region
contextValue = eu
value = another test value

As both "Item A" and "Item B" have the same combination of 'key' and 'contextKey', "Item B" will just overwrite "Item A"...

Support ZooKeeper as a WatchedConfigurationSource versus PollingSource

Requires the following refactorings in archaius-core:

  1. extract out the property-updating functionality into a common utility that can be used by both the PollingScheduler's poller as well as the new WatchedConfiguration's callback method.

  2. create a generic ConfigurationUpdateResult to encapsulate the createFull() and createIncremental() functionality. PollResult can extend this to add the Checkpoint functionality.

Note: my latest implementation has a dependency on Curator.

change in SystemConfiguration priority as of 0.5.3

The test below demonstrates a possible regression bug introduced as of 0.5.3 - and also seen in the latest 0.5.4-SNAPSHOT.

The result is that code using loadCascadedPropertiesFromResources() no longer favors System properties to trump all other properties.

The old code (pre-0.5.3) results in the following configList after this method is called:
SystemConfiguration
DynamicURLConfiguration
ConcurrentMapConfiguration
ConcurrentMapConfiguration

The new code (0.5.3+) results in the following configList after this method is called:
DynamicURLConfiguration
ConcurrentMapConfiguration
SystemConfiguration
ConcurrentMapConfiguration

Not sure if this is intentional, but it is breaking our assumptions (and tests.) I can adjust accordingly - I just need you to confirm that this is the intended behavior.

Thanks!

-Chris


import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.SystemConfiguration;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import com.netflix.config.ConcurrentCompositeConfiguration;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicPropertyFactory;
import com.netflix.config.SimpleDeploymentContext;

/**

  • Test that ConfigurationManager.loadCascadedPropertiesFromResources() will favor SystemConfiguration over all others
    *

  • @author cfregly
    */
    public class SystemPropertyOverrideTest {
    @BeforeClass
    public static void setUp() throws Exception {
    System.setProperty("com.netflix.config.samples.SampleApp.SampleBean.numSeeds", "8");

    SimpleDeploymentContext context = new SimpleDeploymentContext();
    context.setDeploymentEnvironment("test");
    context.setDeploymentRegion("us-east-1");
    ConfigurationManager.setDeploymentContext(context);
    ConfigurationManager.loadCascadedPropertiesFromResources("sampleapp");
    

    }

    @test
    public void testSystemOverride() throws Exception {
    Configuration firstConfig = ((ConcurrentCompositeConfiguration) ConfigurationManager.getConfigInstance()).getConfiguration(0);

    // the first config returned should be the SystemConfiguration
    Assert.assertTrue(firstConfig instanceof SystemConfiguration);
    
    // there's a system property set, so this should trump any other properties that are set
    Assert.assertEquals(8, DynamicPropertyFactory.getInstance().getIntProperty("com.netflix.config.samples.SampleApp.SampleBean.numSeeds", Integer.MIN_VALUE).get());
    

    }
    }

How to load multiple property files into a configuration

This is more like a question and not an issue but I couldn't find anything on the web or in the code that would've pointed me into the right direction.

The problem is as follows:

  • there's a folder with .properties files containing configuration parameters for the app
  • all the properties should be loaded on the same level so they can be overridden by a configuration

In the end I would like to achieve something like this:

ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
finalConfig.addConfiguration(dynamicConfiguration, "dynamicConfig");
finalConfig.addConfiguration(configFromSystemProperties, "systemConfig");
finalConfig.addConfiguration(configFromPropertiesFile, "fileConfig"); //fileConfig should contain the properties from all the files

Dynamic property is not working with local configuration files

Having the following program when changes are made for a property in the prop file doesn't seem to be reflected in the value.

static DynamicLongProperty dynamicLongProperty = DynamicPropertyFactory.getInstance().getLongProperty("a.property", 1010101);

    public static void main(String[] args) throws MalformedURLException, InterruptedException {

        String url = new File("D:\\prop.properties").toURI().toURL().toString();

        DynamicURLConfiguration dynamicURLConfiguration = new DynamicURLConfiguration(10000, 10000, false,
                url);
        ConcurrentMapConfiguration configFromPropertiesFile = new ConcurrentMapConfiguration(dynamicURLConfiguration);

        ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
        finalConfig.addConfiguration(configFromPropertiesFile, "fileConfig");

        ConfigurationManager.install(finalConfig);

        while (true) {
            System.out.println("++++" + dynamicLongProperty.get());
            Thread.sleep(5000);
        }
    }

I can see that when I update the property it gets read by archaius but the value won't change in the sys out:

++++444
11:58:48.954 [pollingConfigurationSource] DEBUG c.n.config.AbstractPollingScheduler - Polling started
11:58:48.954 [pollingConfigurationSource] DEBUG c.n.config.DynamicPropertyUpdater - updating property key [a.property], value [333]
++++444

MBean is not registered automatically when the appropriate property is defined

ConfigurationManager.java:169 will always evaluate to false because we are, in practice, doing this:

if (Boolean.getBoolean("archaius.dynamicPropertyFactory.registerConfigWithJMX"))

what we want is to evaluate the value of the property with that name, not the name of the property.

I am testing against version 0.5.4 published into maven repo, but this is still present in the head as of 2013-01-25 15:38 GMT.

Allow DynamicPropertyFactory.initWithConfigurationSource to be called multiple times

Within a web application it looks like the right place to call DynamicPropertyFactory.initWithConfigurationSource is in ServletContextListener.contextInitialized. The problem is that applications may be updated without the class loader being completely rebuilt. This results in ServletContextListener.contextDestroyed being called and then ServletContextListener.contextInitialized being called a second time. This process repeats every time the application is updated without restarting Tomcat.

The result is that new configuration sources or changes to non-dynamic sources are not picked up.

DynamicPropertyFactory.initWithConfigurationSource already allows the default configuration to be overwritten in the case that it was installed before initWithConfigurationSource was called. I'd like to refactor that execution path so that initWithConfigurationSource will cleanup any installed configuration source and allow the passed in configuration source to be installed. The impact to the public API will be that initWithConfigurationSource will not throw IllegalArgumentException if the factory has already been initialized with a non-default configuration source. Instead it will unload that non-default configuration source and re-initialize with the new one provided to initWithConfigurationSource.

I'm looking for feedback on whether or not this change is interesting to others and whether or not there are other things I need to consider while making this change.

Feature Request: Custom deserialization

Config can often be grouped together rather than splatted out.

Things like DropWizard show some great examples of where combining config into a YAML/JSON object can make things a bit nicer to work with. It would be great if there were a DynamicProperty type that essentially allowed the caller to specify their own deserialization logic such that they could convert "complex" objects into Java config objects.

As it is, I have something similar to archaius setup around storing JSON payloads in a DB. I convert them from the JSON payload into a Java object with Jackson and use that java object as a config object in my code. I'd like to swap in archaius, but I cannot without having to deserialize a string property over and over and over again (or add some complexity with an AtomicReference<> and using the callbacks to deserialize into it).

If I could essentially register my own deserialization archaius and have it such that it would only deserialize into the Java object that I care about when the value changes, that'd be awesome.

TestResources misconfigured

By default, the unittests fail because the resources needed for the tests are not loaded into the classpath because they are not in the target/test-classes directory.

This is typically handled automagically by the process-test-resources phase which would look in ./src/test/resources. I'm sure I'm supposed to be using gradle to build, but it seems like this should have been a multi-module project instead of trying to hardwire the source directories inside the pom.

If we're going to do that, we should also hardwire the testresources and resources directories:

archaius-core/src/main/resources archaius-core/src/test/resources

This also clears up a few unittest failures from a fresh clone :-/

Callbackable DynamicConfiguration

I want to extend DynamicConfiguration, but i find that DynamicConfiguration is only fit to polling properties changes, but not to notify the properties changes. Can anybody help me?
When my properties change, it will call something like this code:
//configInfo is the newest configuration info
public void receiveConfigInfo(String configInfo) {
//apply the new configuration
}

Deployment Context sample?

Hello,

I've reached Archaius through Hystrix and now i use both stacks successfully.
For Archaius, i managed to have multiple file-based configurations defined in a composite one, overriding one another accordingly, as welll as a dynamic one, based on a http source.

Everything works as expected!

Nevertheless, i read about Deployment Context, i think i have a need for it but i cannot grasp its potential as there are not any examples.

What i think i understand:

Each configuration (e.g ConcurrentMapConfiguration) i load in my ConcurrentCompositeConfiguration that i feed into my ConfigurationManager, defines values for a number (should be all???) of the Deployment Context attributes. For example i have a configuration that defines the "archaius.deployment.environment" to be "prod" and the "archaius.deployment.region" to be "us-east-1". This configuration also defines my DB connection string to be "ConnProd". I have another configuration that defines the "archaius.deployment.environment" to be "stage", NO deployment region and the db connection to be "ConnStage". I add both Configurations to my composite one.

Somehow (i need clarification on this one), i define the runtime deployment context to be "stage" and "us-east-1". What does this mean for my global configuration?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.