import org.oransc.enrichment.repository.EiJob;
import org.oransc.enrichment.repository.EiJobs;
import org.oransc.enrichment.repository.EiProducer;
import org.oransc.enrichment.repository.EiJob;
import org.oransc.enrichment.repository.EiJobs;
import org.oransc.enrichment.repository.EiProducer;
import org.oransc.enrichment.repository.EiType;
import org.oransc.enrichment.repository.EiTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.oransc.enrichment.repository.EiType;
import org.oransc.enrichment.repository.EiTypes;
import org.springframework.beans.factory.annotation.Autowired;
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
final boolean isNewJob = this.eiJobs.get(eiJobId) == null;
return validatePutEiJob(eiJobId, eiJobObject) //
final boolean isNewJob = this.eiJobs.get(eiJobId) == null;
return validatePutEiJob(eiJobId, eiJobObject) //
.doOnNext(newEiJob -> this.eiJobs.put(newEiJob)) //
.flatMap(newEiJob -> Mono.just(new ResponseEntity<>(isNewJob ? HttpStatus.CREATED : HttpStatus.OK)))
.onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
}
.doOnNext(newEiJob -> this.eiJobs.put(newEiJob)) //
.flatMap(newEiJob -> Mono.just(new ResponseEntity<>(isNewJob ? HttpStatus.CREATED : HttpStatus.OK)))
.onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
}
- private Mono<EiJob> notifyProducersNewJob(EiJob newEiJob) {
- return this.producerCallbacks.notifyProducersJobStarted(newEiJob) //
+ private Mono<EiJob> startEiJob(EiJob newEiJob) {
+ return this.producerCallbacks.startEiJob(newEiJob, eiProducers) //
.flatMap(noOfAcceptingProducers -> {
if (noOfAcceptingProducers.intValue() > 0) {
return Mono.just(newEiJob);
.flatMap(noOfAcceptingProducers -> {
if (noOfAcceptingProducers.intValue() > 0) {
return Mono.just(newEiJob);