summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2020-01-30 12:02:46 -0500
committerDan Timoney <dtimoney@att.com>2020-06-29 07:53:43 -0400
commit095b4aa10f743b41f2eda31bc57be3657d0868a4 (patch)
tree7acfd61e24d4a32b625b7ea7a31733fc31588042 /ms/blueprintsprocessor/modules/inbounds
parent22c4a1752f9e9487aa63f99b3b79aee1cb5361f6 (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/inbounds')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt48
6 files changed, 34 insertions, 26 deletions
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"