aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/message-prioritizaion/src
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2020-02-01 18:47:59 -0500
committerBrinda Santh <bs2796@att.com>2020-02-01 18:47:59 -0500
commitc6da9f5aaa7c29644ead22d5ba5fc8ef3ec5811a (patch)
tree60d328afa8a7516dec7a2da20bdcc76ee8644bf6 /ms/blueprintsprocessor/functions/message-prioritizaion/src
parent5c094c6adc53d958b2079de67d9d26242e10d7ef (diff)
Expose rest API with non blocking call.
Convert Mono and Flux to coroutines Convert reactor mdc to coroutine mdc Issue-ID: CCSDK-2052 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: Ic58c0b74866d28fd2d803b96626b08f8e8b2db56
Diffstat (limited to 'ms/blueprintsprocessor/functions/message-prioritizaion/src')
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt19
1 files changed, 10 insertions, 9 deletions
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
index e90771fb8..c7aab03b6 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
@@ -20,7 +20,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.M
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.MessagePrioritizationStateService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.UpdateStateRequest
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.monoMdc
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.mdcWebCoroutineScope
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
@@ -39,11 +39,11 @@ open class MessagePrioritizationApi(
@GetMapping(path = ["/ping"], produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
- fun ping(): String = "Success"
+ suspend fun ping(): String = mdcWebCoroutineScope { "Success" }
@GetMapping(path = ["/{id}"], produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
- fun messagePrioritization(@PathVariable(value = "id") id: String) = monoMdc {
+ suspend fun messagePrioritization(@PathVariable(value = "id") id: String) = mdcWebCoroutineScope {
messagePrioritizationStateService.getMessage(id)
}
@@ -52,16 +52,17 @@ open class MessagePrioritizationApi(
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
@ResponseBody
- fun saveMessagePrioritization(@RequestBody messagePrioritization: MessagePrioritization) = monoMdc {
- messagePrioritizationStateService.saveMessage(messagePrioritization)
- }
+ suspend fun saveMessagePrioritization(@RequestBody messagePrioritization: MessagePrioritization) =
+ mdcWebCoroutineScope {
+ messagePrioritizationStateService.saveMessage(messagePrioritization)
+ }
@PostMapping(
path = ["/prioritize"], produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
@ResponseBody
- fun prioritize(@RequestBody messagePrioritization: MessagePrioritization) = monoMdc {
+ suspend fun prioritize(@RequestBody messagePrioritization: MessagePrioritization) = mdcWebCoroutineScope {
messagePrioritizationService.prioritize(messagePrioritization)
}
@@ -69,8 +70,8 @@ open class MessagePrioritizationApi(
path = ["/update-state"], produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
- fun updateMessagePrioritizationState(@RequestBody updateMessageState: UpdateStateRequest) =
- monoMdc {
+ suspend fun updateMessagePrioritizationState(@RequestBody updateMessageState: UpdateStateRequest) =
+ mdcWebCoroutineScope {
messagePrioritizationStateService.setMessageState(
updateMessageState.id,
updateMessageState.state!!