wso2 / carbon-config

40 stars 35 forks source link

Carbon Configuration

Carbon configuration provides a framework for managing server configurations. With global configuration model, server will have only one configuration file for all server configurations. So that,

In global configuration file (deployment.yaml),

Sample file looks like:

  # Carbon Configuration Parameters
wso2.carbon:
  id: carbon-kernel
  version: 5.2.0-SNAPSHOT
  ports:
    offset: 0
  ...

  # Netty Transport Configurations
wso2.transports.netty:
  listeners:
    - id: msf4j-http
      host: 127.0.0.1
      port: 8080
      bossThreadPoolSize: 2
      workerThreadPoolSize: 250
      parameters:
        - name: "executor.workerpool.size"
          value: 60

...

Following annotations are introduced for configuration bean classes.

Sample bean class with above annotations looks like:

 @Configuration(namespace = "wso2.carbon", description = "Carbon Configuration Parameters")
 public class CarbonConfiguration {

     @Element(description = "value to uniquely identify a server", required = true)
     private String id = "carbon-kernel";

     @Element(description = "server name")
     private String name = "WSO2 Carbon Kernel";

     @Element(description = "server version")
     private String version = "5.2.0";

     @Ignore
     private String tenant = Constants.DEFAULT_TENANT;

 }

The framework provides maven plugin to read all configuration bean classes in the component and create the relevant segment of the configuration file(for documentation purposes) automatically at compile time.

The framework provides OSGI service(ConfigProvider) to read configuration from deployment.yaml file. Following apis are read configuration from the file.

For more information, Please refer document link below.