use of org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImpl method createQueryConfigurationsRequest.
private QueryConfigurationsRequest createQueryConfigurationsRequest() {
QueryConfigurationsRequest request = new QueryConfigurationsRequest();
request.setApplication(ConfigCenterConfig.INSTANCE.getAppName());
request.setServiceName(ConfigCenterConfig.INSTANCE.getServiceName());
request.setVersion(ConfigCenterConfig.INSTANCE.getServiceVersion());
request.setEnvironment(ConfigCenterConfig.INSTANCE.getEnvironment());
// 需要设置为 null, 并且 query 参数为 revision=null 才会返回 revision 信息。 revision = 是不行的。
request.setRevision(null);
return request;
}
use of org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterConfigurationSourceImpl method init.
@Override
public void init(Configuration localConfiguration) {
configConverter = new ConfigConverter(ConfigCenterConfig.INSTANCE.getFileSources());
AddressManager kieAddressManager = configKieAddressManager();
HttpTransport httpTransport = createHttpTransport(kieAddressManager, HttpTransportFactory.defaultRequestConfig().build(), localConfiguration);
ConfigCenterClient configCenterClient = new ConfigCenterClient(kieAddressManager, httpTransport);
EventManager.register(this);
QueryConfigurationsRequest queryConfigurationsRequest = firstPull(configCenterClient);
configCenterManager = new ConfigCenterManager(configCenterClient, EventManager.getEventBus(), configConverter);
configCenterManager.setQueryConfigurationsRequest(queryConfigurationsRequest);
configCenterManager.startConfigCenterManager();
}
use of org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterConfigurationSourceImpl method firstPull.
private QueryConfigurationsRequest firstPull(ConfigCenterClient configCenterClient) {
QueryConfigurationsRequest queryConfigurationsRequest = createQueryConfigurationsRequest();
try {
QueryConfigurationsResponse response = configCenterClient.queryConfigurations(queryConfigurationsRequest);
if (response.isChanged()) {
configConverter.updateData(response.getConfigurations());
updateConfiguration(WatchedUpdateResult.createIncremental(configConverter.getCurrentData(), null, null));
queryConfigurationsRequest.setRevision(response.getRevision());
}
} catch (Exception e) {
if (ConfigCenterConfig.INSTANCE.firstPullRequired()) {
throw e;
}
LOGGER.warn("first pull failed, and ignore {}", e.getMessage());
}
return queryConfigurationsRequest;
}
use of org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImpl method init.
@Override
public void init(Configuration localConfiguration) {
configConverter = new ConfigConverter(ConfigCenterConfig.INSTANCE.getFileSources());
AddressManager kieAddressManager = configKieAddressManager();
HttpTransport httpTransport = createHttpTransport(kieAddressManager, HttpTransportFactory.defaultRequestConfig().build(), localConfiguration);
ConfigCenterClient configCenterClient = new ConfigCenterClient(kieAddressManager, httpTransport);
EventManager.register(this);
QueryConfigurationsRequest queryConfigurationsRequest = firstPull(configCenterClient);
configCenterManager = new ConfigCenterManager(configCenterClient, EventManager.getEventBus(), configConverter);
configCenterManager.setQueryConfigurationsRequest(queryConfigurationsRequest);
configCenterManager.startConfigCenterManager();
}
use of org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImpl method firstPull.
private QueryConfigurationsRequest firstPull(ConfigCenterClient configCenterClient) {
QueryConfigurationsRequest queryConfigurationsRequest = createQueryConfigurationsRequest();
try {
QueryConfigurationsResponse response = configCenterClient.queryConfigurations(queryConfigurationsRequest);
if (response.isChanged()) {
configConverter.updateData(response.getConfigurations());
updateConfiguration(WatchedUpdateResult.createIncremental(configConverter.getCurrentData(), null, null));
queryConfigurationsRequest.setRevision(response.getRevision());
}
} catch (Exception e) {
if (ConfigCenterConfig.INSTANCE.firstPullRequired()) {
throw e;
}
LOGGER.warn("first pull failed, and ignore {}", e.getMessage());
}
return queryConfigurationsRequest;
}
Aggregations