You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "Yang Bo (JIRA)" <ji...@apache.org> on 2018/05/16 06:51:00 UTC

[jira] [Updated] (SCB-425) Add an easier way to read configurations

     [ https://issues.apache.org/jira/browse/SCB-425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yang Bo updated SCB-425:
------------------------
    Fix Version/s: java-chassis-1.0.0-m2

> Add an easier way to read configurations
> ----------------------------------------
>
>                 Key: SCB-425
>                 URL: https://issues.apache.org/jira/browse/SCB-425
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>          Components: Java-Chassis
>            Reporter: liubao
>            Priority: Major
>             Fix For: java-chassis-1.0.0-m2
>
>
> Background:
> Read configurations for microservice or operation is quite common in code, e.g.
> {code:java}
> config = CONSUMER_FAULTINJECTION + serviceName + ".schemas." + schema + "."
> + CONSUMER_FAULTINJECTION_POLICY_PROTOCOLS + invocation.getTransport().getName() + "." + key;
> value = getConfigValue(config);
> if ((value != FAULT_INJECTION_DEFAULT_VALUE)) {
> return value;
> }
> config = CONSUMER_FAULTINJECTION + serviceName + "." + CONSUMER_FAULTINJECTION_POLICY_PROTOCOLS
> + invocation.getTransport().getName() + "." + key;
> value = getConfigValue(config);
> if ((value != FAULT_INJECTION_DEFAULT_VALUE)) {
> return value;
> }
> config = CONSUMER_FAULTINJECTION_GLOBAL + CONSUMER_FAULTINJECTION_POLICY_PROTOCOLS
> + invocation.getTransport().getName() + "." + key;
> {code}
> This code is very long and add callbacks if hard for user code. 
>  
> Suggestions:
> We need a easier way to read configurations, code snippets: 
> {code:java}
> @Configuration(name="cse.myconfiguration")
> class MyConfiguration
> {
>    @Configuration(name="prop1")
>    String prop1;
>    @Configuration(name="prop2")
>    String prop2;
> }
> MyConfiguration configuration = ConfigurationFactory.getReference(invocation.getQualifiedMicroserviceName()){code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)