import kotlinx.coroutines.launch
import kotlinx.coroutines.withTimeout
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GrpcClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcClientService
-import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BlueprintGrpcClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BlueprintGrpcLibPropertyService
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
prefix = "blueprintsprocessor.streamingRemoteExecution", name = ["enabled"],
havingValue = "true", matchIfMissing = false
)
-class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService) :
+class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertyService: BlueprintGrpcLibPropertyService) :
StreamingRemoteExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
private val log = logger(StreamingRemoteExecutionServiceImpl::class)
val grpcChannel = grpcChannel(selector)
/** Get Send and Receive Channel for bidirectional process method*/
- val channels = clientCallBidiStreaming(BluePrintProcessingServiceGrpc.getProcessMethod(), grpcChannel)
+ val channels = clientCallBidiStreaming(BlueprintProcessingServiceGrpc.getProcessMethod(), grpcChannel)
commChannels[txId] = channels
}
val commChannel = commChannels[txId]
- ?: throw BluePrintException("failed to create response subscription for transactionId($txId) channel")
+ ?: throw BlueprintException("failed to create response subscription for transactionId($txId) channel")
log.info("created subscription for transactionId($txId)")
*/
override suspend fun send(txId: String, input: ExecutionServiceInput) {
val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ ?: throw BlueprintException("failed to get transactionId($txId) send channel")
coroutineScope {
launch {
sendChannel.send(input)
/** Send the request */
val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ ?: throw BlueprintException("failed to get transactionId($txId) send channel")
sendChannel.send(input)
/** Receive the response with timeout */
}
suspend fun createGrpcChannel(grpcProperties: GrpcClientProperties): ManagedChannel {
- val grpcClientService: BluePrintGrpcClientService = bluePrintGrpcLibPropertyService
+ val grpcClientService: BlueprintGrpcClientService = bluePrintGrpcLibPropertyService
.blueprintGrpcClientService(grpcProperties)
return grpcClientService.channel()
}
selector
}
else -> {
- throw BluePrintException("couldn't process selector($selector)")
+ throw BlueprintException("couldn't process selector($selector)")
}
}
}