Added some logging 80/5480/1
authorPatrikBuhr <patrik.buhr@est.tech>
Wed, 20 Jan 2021 12:38:12 +0000 (13:38 +0100)
committerPatrikBuhr <patrik.buhr@est.tech>
Wed, 20 Jan 2021 12:38:53 +0000 (13:38 +0100)
Change-Id: I5721d68f35919fec3acc50233cad3d9cf6046f23
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-378

enrichment-coordinator-service/src/main/java/org/oransc/enrichment/configuration/ApplicationConfig.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/tasks/ProducerSupervision.java

index db4201b..5493fd8 100644 (file)
@@ -23,6 +23,8 @@ package org.oransc.enrichment.configuration;
 import lombok.Getter;
 
 import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -31,6 +33,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 @ConfigurationProperties()
 public class ApplicationConfig {
 
+    private static final Logger logger = LoggerFactory.getLogger(ApplicationConfig.class);
+
     @Getter
     @Value("${app.vardata-directory}")
     private String vardataDirectory;
@@ -66,6 +70,11 @@ public class ApplicationConfig {
 
     public WebClientConfig getWebClientConfig() {
         if (this.webClientConfig == null) {
+            if (this.httpProxyPort == 0) {
+                logger.info("Http proxy is not used");
+            } else {
+                logger.info("Http proxy is used for RAN access {}:{}", httpProxyHost, httpProxyPort);
+            }
             HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
                 .httpProxyHost(this.httpProxyHost) //
                 .httpProxyPort(this.httpProxyPort) //
index f5224f2..2f36115 100644 (file)
@@ -165,7 +165,7 @@ public class EiJobs {
                 out.print(gson.toJson(job));
             }
         } catch (Exception e) {
-            logger.warn("Could not save job: {} {}", job.getId(), e.getMessage());
+            logger.warn("Could not store job: {} {}", job.getId(), e.getMessage());
         }
     }
 
index c2e4b97..d73127f 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.oransc.enrichment.tasks;
 
-import java.time.Duration;
-
 import org.oransc.enrichment.configuration.ApplicationConfig;
 import org.oransc.enrichment.controllers.consumer.ConsumerCallbacks;
 import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
@@ -86,19 +84,15 @@ public class ProducerSupervision {
     }
 
     private Mono<?> checkProducerJobs(EiProducer producer) {
+        final int MAX_CONCURRENCY = 10;
         return getEiJobs(producer) //
             .filter(eiJob -> !producer.isJobEnabled(eiJob)) //
-            .flatMap(eiJob -> startEiJob(producer, eiJob), 1) //
+            .flatMap(eiJob -> producerCallbacks.startEiJob(producer, eiJob, Retry.max(1)), MAX_CONCURRENCY) //
             .collectList() //
-            .flatMapMany(eiJob -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
+            .flatMapMany(startedJobs -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
             .collectList();
     }
 
-    private Mono<String> startEiJob(EiProducer producer, EiJob eiJob) {
-        Retry retrySpec = Retry.fixedDelay(1, Duration.ofSeconds(1));
-        return producerCallbacks.startEiJob(producer, eiJob, retrySpec);
-    }
-
     private Flux<EiJob> getEiJobs(EiProducer producer) {
         return Flux.fromIterable(producer.getEiTypes()) //
             .flatMap(eiType -> Flux.fromIterable(eiJobs.getJobsForType(eiType)));