All Projects → scalecube → scalecube-config

scalecube / scalecube-config

Licence: Apache-2.0 license
ScaleCube Config is a configuration access management library for JVM based distributed applications

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to scalecube-config

delta
DDD-centric event-sourcing library for the JVM
Stars: ✭ 15 (+0%)
Mutual labels:  jvm, distributed
configuration-service
Configuration Service is a distributed configuration provider for .NET Core.
Stars: ✭ 62 (+313.33%)
Mutual labels:  configuration, distributed
Xxl Conf
A lightweight distributed configuration management platform. (分布式配置管理平台XXL-CONF)
Stars: ✭ 619 (+4026.67%)
Mutual labels:  configuration, distributed
Intellij Jvm Options Explained
Common JVM options used with Intellij and what they do
Stars: ✭ 636 (+4140%)
Mutual labels:  jvm, configuration
Titanoboa
Titanoboa makes complex workflows easy. It is a low-code workflow orchestration platform for JVM - distributed, highly scalable and fault tolerant.
Stars: ✭ 787 (+5146.67%)
Mutual labels:  jvm, distributed
Ballista
Distributed compute platform implemented in Rust, and powered by Apache Arrow.
Stars: ✭ 2,274 (+15060%)
Mutual labels:  jvm, distributed
Java Notes
📚 计算机科学基础知识、Java开发、后端/服务端、面试相关 📚 computer-science/Java-development/backend/interview
Stars: ✭ 1,284 (+8460%)
Mutual labels:  jvm, distributed
Konfig
Simple config properties API for Kotlin
Stars: ✭ 249 (+1560%)
Mutual labels:  jvm, configuration
phylanx
An Asynchronous Distributed C++ Array Processing Toolkit
Stars: ✭ 71 (+373.33%)
Mutual labels:  distributed
dotfiles
🔧 .files - different setups separated in branches
Stars: ✭ 168 (+1020%)
Mutual labels:  configuration
dev-feed
Flutter-based mobile app displaying a list of daily curated content from top engineering blogs and articles. Backed by a GraphQL-based API written in Kotlin..
Stars: ✭ 20 (+33.33%)
Mutual labels:  jvm
circe-config
Yet another Typesafe config Scala wrapper powered by circe
Stars: ✭ 18 (+20%)
Mutual labels:  configuration
xoom-cluster
The VLINGO XOOM platform SDK cluster management for Reactive, scalable resiliency of JVM tools and applications running on XOOM LATTICE and XOOM ACTORS.
Stars: ✭ 25 (+66.67%)
Mutual labels:  jvm
metrics-agent
JVM agent based metrics with Prometheus and Dropwizard support (Java, Scala, Clojure, Kotlin, etc)
Stars: ✭ 25 (+66.67%)
Mutual labels:  jvm
dtmcli-php
a php client for distributed transaction framework dtm.
Stars: ✭ 26 (+73.33%)
Mutual labels:  distributed
gl-ionic2-env-configuration
An Ionic2 Service to load an environment specific configuration before everything else
Stars: ✭ 23 (+53.33%)
Mutual labels:  configuration
dnr-editor
Distributed Data-Flow Coordination Platform Based on Node-RED
Stars: ✭ 72 (+380%)
Mutual labels:  distributed
frontend-platform
A framework for Open edX micro-frontend applications.
Stars: ✭ 17 (+13.33%)
Mutual labels:  configuration
Configuration
Hierarchical configuration manager for Swift applications
Stars: ✭ 72 (+380%)
Mutual labels:  configuration
PropertiesFile4Delphi
Library for managing configuration files with key-value syntax
Stars: ✭ 17 (+13.33%)
Mutual labels:  configuration

ScaleCube Config

Maven Central

ScaleCube Config is a configuration management library for JVM based distributed applications.

It provides the following functionality:

  • Dynamic typed properties
  • Register callbacks on property changes
  • Object binding for grouping properties
  • Extensible range of supported property sources (environment variables, program arguments, classpath, property files, mongodb, git repository, zookeeper etc.)
  • Support centralized hierarchical property sources
  • Control over order of applying different property sources
  • Audit log of property changes
  • Expose properties and settings via JMX and/or HTTP

Usage

Configure and create configuration registry instance:

Predicate<Path> predicate = path -> path.toString().endsWith(".props"); // match by .props extension
ConfigRegistrySettings settings = ConfigRegistrySettings.builder()
        .addLastSource("classpath", new ClassPathConfigSource(predicate))
        .addLastSource("configDirectory", new DirectoryConfigSource("conf" /* base path */, predicate))
        .addListener(new Slf4JConfigEventListener()) // print all property changes to log
        .build();
ConfigRegistry configRegistry = ConfigRegistry.create(settings);

Get dynamic typed configuration property:

LongConfigProperty timeoutProperty = configRegistry.longProperty("http.request-timeout");
long timeout = timeoutProperty.get(30 /* default value */);

Register callbacks on property modifications:

timeoutProperty.addCallback((oldValue, newValue) -> 
        System.out.println("Timeout value changed to " + newValue));

Register validators on property values (only values which passed all validators will be applied):

timeoutProperty.addValidator(val -> val >= 0); // timeout can't be negative

Utilize object binding:

// Define configuration class
public interface MyConfig {
  private boolean meaning;
  private int answer;
  private double realAnswer;
  ...
}

// myapp.config.meaning=true
// myapp.config.answer=42
// myapp.config.realAnswer=42.000000000000001
ObjectConfigProperty<MyConfig> config = configRegistry.objectProperty("myapp.config", MyConfig.class);

// Get current config values
MyConfig currentConfig = config.value(MyConfig.defaultValue() /* or default */);

// Register callback (called only once per config reload even when several properties changed)
config.addCallback((oldConfig, newConfig) -> 
        System.out.println("MyConfig updated from " + oldConfig + " to " + newConfig)); 
        
// Register validator
// If meaning is present, an answer should be at least as big as the answer  
config.addValidator(val -> val.meaning && val.answer >= 42);     

Start embedded HTTP server which exposes configuration endpoints:

ConfigRegistryHttpServer.create(configRegistry, 5050); // starts http server on port 5050

After HTTP server is started explore configuration registry by browsing following endpoints:

See more examples at config-examples module.

Maven

Binaries and dependency information for Maven can be found at http://search.maven.org.

Change history and version numbers can be found at CHANGES.md.

Maven dependency:

<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>config</artifactId>
  <version>x.y.z</version>
</dependency>

<!-- For exposing config HTTP endpoints -->
<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>config-http-server</artifactId>
  <version>x.y.z</version>
</dependency>

<!-- For MongoDB integration (beta version) -->
<dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>config-mongo</artifactId>
  <version>x.y.z</version>
</dependency>

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

License

Apache License, Version 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].