aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
diff options
context:
space:
mode:
authorJakub Zieba <jakub.zieba@nokia.com>2018-08-28 14:07:56 +0200
committerJakub Zieba <jakub.zieba@nokia.com>2018-08-29 13:09:46 +0200
commit4fbb9e8ad097c9ec3c3434ba257e887fb3a64699 (patch)
treeb244acb1fd41b987afd514205636f16fe6d5e76e /prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
parent5b4e3b195960af161604eccb1c1c805bb91c6648 (diff)
Revert web server to prh, fix configuration
Revert web server to prh, becaue it is used by health check Fix cloud configuration fetching Additional code refactoring Change-Id: Ic3d6f4c266064436e2701ec3ef3a7534b2d5b8b4 Issue-ID: DCAEGEN2-696 Signed-off-by: Jakub Zieba <jakub.zieba@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
index 82017a9d..b774f545 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
@@ -27,45 +27,42 @@ import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.prh.model.EnvProperties;
-import org.onap.dcaegen2.services.prh.service.HttpClientExecutorService;
+import org.onap.dcaegen2.services.prh.service.PrhConfigurationProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.TaskScheduler;
+import org.springframework.context.annotation.Primary;
import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
+
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 8/9/18
*/
@Configuration
@EnableConfigurationProperties
@EnableScheduling
+@Primary
public class CloudConfiguration extends AppConfig {
private Logger logger = LoggerFactory.getLogger(this.getClass());
- private HttpClientExecutorService httpClientExecutorService;
+ private PrhConfigurationProvider prhConfigurationProvider;
private AaiClientConfiguration aaiClientCloudConfiguration;
private DmaapPublisherConfiguration dmaapPublisherCloudConfiguration;
private DmaapConsumerConfiguration dmaapConsumerCloudConfiguration;
- TaskScheduler cloudTaskScheduler;
-
@Value("#{systemEnvironment}")
private Properties systemEnvironment;
@Autowired
- public void setThreadPoolTaskScheduler(ThreadPoolTaskScheduler threadPoolTaskScheduler,
- HttpClientExecutorService httpClientExecutorService) {
- this.cloudTaskScheduler = threadPoolTaskScheduler;
- this.httpClientExecutorService = httpClientExecutorService;
+ public void setThreadPoolTaskScheduler(PrhConfigurationProvider prhConfigurationProvider) {
+ this.prhConfigurationProvider = prhConfigurationProvider;
}
protected void runTask() {
@@ -84,10 +81,8 @@ public class CloudConfiguration extends AppConfig {
private void parsingConfigSuccess(EnvProperties envProperties) {
logger.info("Fetching PRH configuration from ConfigBindingService/Consul");
- Flux.just(httpClientExecutorService.callConsulForConfigBindingServiceEndpoint(envProperties))
- .flatMap(configBindingServiceUri -> httpClientExecutorService
- .callConfigBindingServiceForPrhConfiguration(envProperties,
- configBindingServiceUri)).subscribe(this::parseCloudConfig, this::cloudConfigError);
+ prhConfigurationProvider.callForPrhConfiguration(envProperties)
+ .subscribe(this::parseCloudConfig, this::cloudConfigError);
}
private void parseCloudConfig(JsonObject jsonObject) {