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;
public class ProducerCallbacks {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static Gson gson = new GsonBuilder() //
- .serializeNulls() //
- .create(); //
+ private static Gson gson = new GsonBuilder().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()) {
* @return the body of the response from the REST call
*/
public Mono<String> notifyProducerJobStarted(EiProducer producer, EiJob eiJob) {
- AsyncRestClient restClient = restClient();
ProducerJobInfo request = new ProducerJobInfo(eiJob);
String body = gson.toJson(request);
});
}
- private AsyncRestClient restClient() {
- return new AsyncRestClient("", this.applicationConfig.getWebClientConfig());
- }
-
}