Skip to content

ConfigHubPub/JavaAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaAPI

ConfigHub Java Client API

JavaDoc

Configuration Pull Example:

import com.confighub.client.*;

public class PullTest
{
    public static void main(String... args)
    {
        ConfigHub configHub = new ConfigHub("ConfigHub", "Demo")
            .setContext("Production;PullTest")
            .setApplicationName("PullTest");
            .setConfighubServerAddress("demo.confighub.com");

        confighub.pull();

        // Get a few properties returned from the pull request
        int dbPort = configHub.properties.getInteger("db.port");
        String dbHost = configHub.properties.get("db.host");

        // Get structured data
        Map<String, String> map =
                configHub.properties.getMap("client.labels");

        // Get some config files
        String log4jxml = confighub.files.get("/logger/log4j2.xml");
        String tomeeXml = confighub.files.get("/server/tomee.xml");
    }
}

Configuration Push Example

import com.confighub.client.*;

public class PushTest
{
    public static void main(String... args)
    {
        ConfigHub configHub = new ConfigHub("ConfigHub", "Demo")
            .setApplicationName("PushTest")
            .setConfighubServerAddress("demo.confighub.com");

        // Update a single value
        configHub.pushQueue.key("count.total")
                           .setValue(32, "Production;PushTest");

        // Update multiple values for a single key
        configHub.pushQueue.key("logger.level")
                           .setValue("DEBUG", "*;PushTest")
                           .setValue("INFO", "Production;PushTest");

        PushResponse response = configHub.pushQueue.flush();
    }
}

About

ConfigHub Java Client API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages