X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Fcontrollers%2Fr1producer%2FProducerController.java;h=29426ab02c41fdcb3beb24865896712b80839a1e;hb=366bc97828bf62e39a41318c1407a2c7c8cb5b74;hp=15bd56ddf39cbbfdfb69ec9c96c3b327b58d06b0;hpb=4c571ffb2d7e8b01d7bd2e66f15b7c610532e579;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java index 15bd56dd..29426ab0 100644 --- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java +++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java @@ -46,6 +46,7 @@ import org.oransc.enrichment.repository.InfoJobs; import org.oransc.enrichment.repository.InfoProducer; import org.oransc.enrichment.repository.InfoProducers; import org.oransc.enrichment.repository.InfoType; +import org.oransc.enrichment.repository.InfoTypeSubscriptions; import org.oransc.enrichment.repository.InfoTypes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -75,6 +76,9 @@ public class ProducerController { @Autowired private InfoProducers infoProducers; + @Autowired + private InfoTypeSubscriptions typeSubscriptions; + @GetMapping(path = ProducerConsts.API_ROOT + "/info-types", produces = MediaType.APPLICATION_JSON_VALUE) // @Operation(summary = "Info Type identifiers", description = "") // @ApiResponses( @@ -145,7 +149,9 @@ public class ProducerController { if (registrationInfo.jobDataSchema == null) { return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST); } - this.infoTypes.put(new InfoType(infoTypeId, registrationInfo.jobDataSchema)); + InfoType newDefinition = new InfoType(infoTypeId, registrationInfo.jobDataSchema); + this.infoTypes.put(newDefinition); + this.typeSubscriptions.notifyTypeRegistered(newDefinition); return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK); } @@ -184,6 +190,7 @@ public class ProducerController { return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE); } this.infoTypes.remove(type); + this.typeSubscriptions.notifyTypeRemoved(type); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }