Hi all,

In Carbon C5, we are going to introduce new global configuration model
where we have only one configuration file for all server configurations. So
that user have to maintain only one config file for a server.

With New Configuration Model,

   - Global configuration file (deployment.yaml) includes minimal sets of
   configurations which need to override very often by default (e.g: server
   ports etc).
   - All user settable configurations must have default values and they are
   burnt into compile codes.
   - Any default configuration can overridden by adding the particular
   configuration to the global configuration file(deployment.yaml).
   - Defining all configurations in the configuration file in not required.
   add only if we need to override the default value.
   - If configurations are not specified in the configuration file, values
   defined in the bean class will apply by default.

In global configuration file (deployment.yaml),

   - Each component will have their own configurations with a unique
   namespace (e.g: wso2.carbon, wso2.transports.netty etc) and it will be a
   fragment of deployment.yaml file. Please find the sample file below.
   - At runtime, the relevant config bean will be generated by overriding
   the default values specified in bean class with values mentioned in
   deployment.yaml file.

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

...

Along with the above design, we are going to introduce new annotation model
to the configuration beans. So each component will have its configuration
defined as one or more Java beans annotated with the following annotations

   - *org.wso2.carbon.kernel.annotations.Configuration* - *Class level
   annotation, This corresponds to a configuration bean to be used by a
   component*
   - *org.wso2.carbon.kernel.annotations.Element* - *Field level
   annotation, This corresponds to a fields of the class*
   - *org.wso2.carbon.kernel.annotations.Ignore* - *Field level annotation,
   This is to specify that field needs to be ignored when the configuration is
   generated*

Sample bean class 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;

...

}

So we are going to generate the relevant segment of the configuration
file(for documentation purposes) automatically at compile time by reading
above annotations and default values.

If anyone needs to override the default value, He needs to copy the
particular segment of the configuration to the deployment.yaml and change
the value.

Appreciate your input on this.

Thanks
-- 

*Danesh Kuruppu*
Senior Software Engineer | WSO2

Email: dan...@wso2.com
Mobile: +94 (77) 1690552
Web: WSO2 Inc <https://wso2.com/signature>
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to