aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-09-04 09:29:49 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-09-04 09:29:49 +0200
commit83df6e1df5ec20627c85af9ba2f49036dd58f328 (patch)
treede9282995bc4c7b0d0f277760b1d6f3574970794 /prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java
parent3c2766d8a64d21f402b5234e33419a8aed14d7ea (diff)
Refatoring due to prh workflow
1. Added specified HttpClient for DmaaPPublisher: *DmaaP Handle transfer-encoding: chunk header and reject the request if it will be set by the client. In conclusion no other reactive http client can be used for pushing something to dmaap. 2. Added sll support to A&AI rective webclient. *Behaviour of reactive A&AI HttpClient is different as in native spring have without it. 3. Added 10s fixed time in PRH for requesting DmaaP. 4. Added debug log in reactive/native http clients. 5. Fixed reactive workflow of prh. 6. Updated the version of: * spring-boot-dependencies:2.0.1.RELEASE->2.0.4.RELEASE * spring-boot-starter-reactor-netty:2.0.2.RELEASE->2.0.4.RELEASE * spring-webflux:5.0.5.RELEASE->5.0.8.RELEASE * reactor-bom:Bismuth-RELEASE->Bismuth-SR10 Change-Id: I815ffb5bdcf48d94f3b7c64040a73e98e404a5e8 Issue-ID: DCAEGEN2-743 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java
index d3b6cbb3..fdf6847b 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/EnvironmentProcessor.java
@@ -20,14 +20,15 @@
package org.onap.dcaegen2.services.prh.configuration;
-import java.util.Optional;
-import java.util.Properties;
import org.onap.dcaegen2.services.prh.exceptions.EnvironmentLoaderException;
import org.onap.dcaegen2.services.prh.model.EnvProperties;
import org.onap.dcaegen2.services.prh.model.ImmutableEnvProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+import java.util.Optional;
+import java.util.Properties;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 8/10/18
@@ -35,23 +36,23 @@ import reactor.core.publisher.Flux;
class EnvironmentProcessor {
private static final int DEFAULT_CONSUL_PORT = 8500;
- private static Logger logger = LoggerFactory.getLogger(EnvironmentProcessor.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(EnvironmentProcessor.class);
private EnvironmentProcessor() {
}
- static Flux<EnvProperties> evaluate(Properties systemEnvironment) {
- logger.info("Loading configuration from system environment variables {}", systemEnvironment);
+ static Mono<EnvProperties> evaluate(Properties systemEnvironment) {
+ LOGGER.info("Loading configuration from system environment variables");
EnvProperties envProperties;
try {
envProperties = ImmutableEnvProperties.builder().consulHost(getConsulHost(systemEnvironment))
.consulPort(getConsultPort(systemEnvironment)).cbsName(getConfigBindingService(systemEnvironment))
.appName(getService(systemEnvironment)).build();
} catch (EnvironmentLoaderException e) {
- return Flux.error(e);
+ return Mono.error(e);
}
- logger.info("Evaluated environment system variables {}", envProperties);
- return Flux.just(envProperties);
+ LOGGER.info("Evaluated environment system variables {}", envProperties);
+ return Mono.just(envProperties);
}
private static String getConsulHost(Properties systemEnvironments) throws EnvironmentLoaderException {
@@ -78,8 +79,8 @@ class EnvironmentProcessor {
}
private static Integer getDefaultPortOfConsul() {
- logger.warn("$CONSUL_PORT environment has not been defined");
- logger.warn("$CONSUL_PORT variable will be set to default port {}", DEFAULT_CONSUL_PORT);
+ LOGGER.warn("$CONSUL_PORT environment has not been defined");
+ LOGGER.warn("$CONSUL_PORT variable will be set to default port {}", DEFAULT_CONSUL_PORT);
return DEFAULT_CONSUL_PORT;
}
}