diff options
author | Oleg Mitsura <oleg.mitsura@amdocs.com> | 2020-01-30 12:02:46 -0500 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-06-29 07:53:43 -0400 |
commit | 095b4aa10f743b41f2eda31bc57be3657d0868a4 (patch) | |
tree | 7acfd61e24d4a32b625b7ea7a31733fc31588042 /ms/blueprintsprocessor/modules | |
parent | 22c4a1752f9e9487aa63f99b3b79aee1cb5361f6 (diff) |
(elAlto) Scheduler for process. Healthcheck not blocked.5.0.2-ONAPelalto
Issue-ID: CCSDK-2052
Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com>
Change-Id: I7388e593116989e775850922a4ab28a34070da31
Diffstat (limited to 'ms/blueprintsprocessor/modules')
19 files changed, 47 insertions, 39 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml index 0bdb2421c..194090ed1 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>db-lib</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml index 1fd3a0faa..e0b06e8e7 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>dmaap-lib</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml index cf30fe82c..059001755 100644 --- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml @@ -18,7 +18,7 @@ <parent> <artifactId>commons</artifactId> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml index fcce622cf..8beb8e44d 100644 --- a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml @@ -18,7 +18,7 @@ <parent> <artifactId>commons</artifactId> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml index 10746a0d9..1ebee2993 100755 --- a/ms/blueprintsprocessor/modules/commons/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>commons</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml index db14b6373..930bccdf6 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>processor-core</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml index 0fc679727..f9a56c7ea 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>rest-lib</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml index ff1224bfe..4d0ef064b 100644 --- a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml @@ -18,7 +18,7 @@ <parent> <artifactId>commons</artifactId> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml index 4fd567de4..8026a599e 100644 --- a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml @@ -19,12 +19,12 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>inbounds</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>configs-api</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> <packaging>jar</packaging> <name>Blueprints Processor Resource Configurations API</name> <description>Blueprints Processor Resource Configurations API</description> diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml index e9bda82d6..efd052bbe 100644 --- a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml @@ -18,7 +18,7 @@ <parent> <artifactId>inbounds</artifactId> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>designer-api</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index fe139128e..46e20d96b 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>inbounds</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml index 8f8d86f2e..5a2994667 100644 --- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>inbounds</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>resource-api</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml index 583e179ac..6197770af 100755 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>inbounds</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>selfservice-api</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt index cc1229623..0b1fd18d3 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt @@ -35,15 +35,17 @@ import org.springframework.http.ResponseEntity import org.springframework.http.codec.multipart.FilePart import org.springframework.security.access.prepost.PreAuthorize import org.springframework.web.bind.annotation.* +import reactor.core.publisher.Mono +import reactor.core.scheduler.Schedulers import java.util.concurrent.Phaser import javax.annotation.PreDestroy @RestController @RequestMapping("/api/v1/execution-service") @Api(value = "/api/v1/execution-service", - description = "Interaction with CBA.") + description = "Interaction with CBA.") open class ExecutionServiceController { - + private val scheduler = Schedulers.newElastic("bpthread") private val log = logger(ExecutionServiceController::class) private val ph = Phaser(1) @@ -52,8 +54,8 @@ open class ExecutionServiceController { lateinit var executionServiceHandler: ExecutionServiceHandler @RequestMapping(path = ["/health-check"], - method = [RequestMethod.GET], - produces = [MediaType.APPLICATION_JSON_VALUE]) + method = [RequestMethod.GET], + produces = [MediaType.APPLICATION_JSON_VALUE]) @ResponseBody @ApiOperation(value = "Health Check", hidden = true) fun executionServiceControllerHealthCheck(): JsonNode = runBlocking { @@ -64,8 +66,8 @@ open class ExecutionServiceController { @ResponseBody @PreAuthorize("hasRole('USER')") @ApiOperation(value = "Upload a CBA", - notes = "Upload the CBA package. This will also run validation on the CBA.", - produces = MediaType.APPLICATION_JSON_VALUE) + notes = "Upload the CBA package. This will also run validation on the CBA.", + produces = MediaType.APPLICATION_JSON_VALUE) fun upload(@ApiParam(value = "The ZIP file containing the overall CBA package.", required = true) @RequestPart("file") filePart: FilePart): JsonNode = runBlocking { val uploadId = executionServiceHandler.upload(filePart) @@ -74,8 +76,8 @@ open class ExecutionServiceController { @DeleteMapping("/name/{name}/version/{version}") @ApiOperation(value = "Delete a CBA", - notes = "Delete the CBA package identified by its name and version.", - produces = MediaType.APPLICATION_JSON_VALUE) + notes = "Delete the CBA package identified by its name and version.", + produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("hasRole('USER')") fun deleteBlueprint(@ApiParam(value = "Name of the CBA.", required = true) @PathVariable(value = "name") name: String, @@ -86,24 +88,30 @@ open class ExecutionServiceController { @RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE]) @ApiOperation(value = "Execute a CBA workflow (action)", - notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.", - produces = MediaType.APPLICATION_JSON_VALUE, - response = ExecutionServiceOutput::class) + notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.", + produces = MediaType.APPLICATION_JSON_VALUE, + response = ExecutionServiceOutput::class) @ResponseBody @PreAuthorize("hasRole('USER')") fun process(@ApiParam(value = "ExecutionServiceInput payload.", required = true) - @RequestBody executionServiceInput: ExecutionServiceInput): ResponseEntity<ExecutionServiceOutput> = - runBlocking { - if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) { - throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.") - } + @RequestBody executionServiceInput: ExecutionServiceInput): Mono<ResponseEntity<ExecutionServiceOutput>> { + return Mono.fromSupplier { this.bpProcessBlockingWrapper(executionServiceInput) } + .subscribeOn(scheduler) + } - ph.register() - val processResult = executionServiceHandler.doProcess(executionServiceInput) - ph.arriveAndDeregister() - ResponseEntity(processResult, determineHttpStatusCode(processResult.status.code)) + private fun bpProcessBlockingWrapper(executionServiceInput: ExecutionServiceInput): ResponseEntity<ExecutionServiceOutput> { + return runBlocking { + if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) { + throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.") } + ph.register() + val processResult = executionServiceHandler.doProcess(executionServiceInput) + ph.arriveAndDeregister() + ResponseEntity(processResult, determineHttpStatusCode(processResult.status.code)) + } + } + @PreDestroy fun preDestroy() { val name = "ExecutionServiceController" diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml index d2b09e210..68057050e 100644 --- a/ms/blueprintsprocessor/modules/outbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>outbounds</artifactId> diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml index c7302db2d..051ae5ed4 100644 --- a/ms/blueprintsprocessor/modules/pom.xml +++ b/ms/blueprintsprocessor/modules/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>parent</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> <relativePath>../parent</relativePath> </parent> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index bd586649b..54cfda0ad 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>services</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>execution-service</artifactId> diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml index 6112fecef..b6d2da3cf 100755 --- a/ms/blueprintsprocessor/modules/services/pom.xml +++ b/ms/blueprintsprocessor/modules/services/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <artifactId>services</artifactId> diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml index 807996389..19ea37bab 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>services</artifactId> - <version>0.6.5-SNAPSHOT</version> + <version>0.6.6-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> |