X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Fclients%2FProducerCallbacks.java;h=9b238654ce1006d73ad8919f587209485fca2995;hb=b5aa1b04fe2cf730c434e3d5d103b3ab357f2292;hp=7f28a12bac4b787b372ce38396f2f2196f504ab9;hpb=5d97a401dc1e26f64ad57daab90f924da9c12c64;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/ProducerCallbacks.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/ProducerCallbacks.java index 7f28a12b..9b238654 100644 --- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/ProducerCallbacks.java +++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/ProducerCallbacks.java @@ -30,7 +30,6 @@ import org.oransc.enrichment.repository.EiJob; import org.oransc.enrichment.repository.EiProducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -46,11 +45,14 @@ public class ProducerCallbacks { .serializeNulls() // .create(); // - @Autowired - ApplicationConfig applicationConfig; + private final AsyncRestClient restClient; + + public ProducerCallbacks(ApplicationConfig config) { + AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig()); + this.restClient = restClientFactory.createRestClient(""); + } public void notifyProducersJobDeleted(EiJob eiJob) { - AsyncRestClient restClient = restClient(); ProducerJobInfo request = new ProducerJobInfo(eiJob); String body = gson.toJson(request); for (EiProducer producer : eiJob.type().getProducers()) { @@ -81,7 +83,6 @@ public class ProducerCallbacks { * @return the body of the response from the REST call */ public Mono notifyProducerJobStarted(EiProducer producer, EiJob eiJob) { - AsyncRestClient restClient = restClient(); ProducerJobInfo request = new ProducerJobInfo(eiJob); String body = gson.toJson(request); @@ -93,8 +94,4 @@ public class ProducerCallbacks { }); } - private AsyncRestClient restClient() { - return new AsyncRestClient("", this.applicationConfig.getWebClientConfig()); - } - }