import io.grpc.Status
import io.grpc.stub.StreamObserver
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintCoreConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.toJava
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.BlueprintProcessingServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+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.onap.ccsdk.cds.error.catalog.core.ErrorCatalogCodes
import javax.annotation.PreDestroy
@Service
-open class BlueprintProcessingGRPCHandler(
- private val bluePrintCoreConfiguration: BlueprintCoreConfiguration,
+open class BluePrintProcessingGRPCHandler(
+ private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
private val executionServiceHandler: ExecutionServiceHandler,
private val errorCatalogService: ErrorCatalogService
) :
- BlueprintProcessingServiceGrpc.BlueprintProcessingServiceImplBase() {
+ BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
- private val log = LoggerFactory.getLogger(BlueprintProcessingGRPCHandler::class.java)
+ private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
private val ph = Phaser(1)
override fun onError(error: Throwable) {
log.debug("Fail to process message", error)
- if (error is BlueprintProcessorException) onErrorCatalog(error) else onError(error)
+ if (error is BluePrintProcessorException) onErrorCatalog(error) else onError(error)
}
fun onError(error: Exception) {
)
}
- fun onErrorCatalog(error: BlueprintProcessorException) {
+ fun onErrorCatalog(error: BluePrintProcessorException) {
if (error.protocol == "") {
error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
}
@PreDestroy
fun preDestroy() {
- val name = "BlueprintProcessingGRPCHandler"
+ val name = "BluePrintProcessingGRPCHandler"
log.info("Starting to shutdown $name waiting for in-flight requests to finish ...")
ph.arriveAndAwaitAdvance()
log.info("Done waiting in $name")