use of org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub in project so by onap.
the class CDSProcessingHandler method process.
CountDownLatch process(ExecutionServiceInput request, ManagedChannel channel) {
ActionIdentifiers header = request.getActionIdentifiers();
log.info("Processing blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(), header.getActionName());
final CountDownLatch finishLatch = new CountDownLatch(1);
final BluePrintProcessingServiceStub asyncStub = BluePrintProcessingServiceGrpc.newStub(channel);
final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
@Override
public void onNext(ExecutionServiceOutput output) {
listener.onMessage(output);
}
@Override
public void onError(Throwable t) {
listener.onError(t);
finishLatch.countDown();
}
@Override
public void onCompleted() {
log.info("Completed blueprint({}:{}) for action({})", header.getBlueprintVersion(), header.getBlueprintName(), header.getBlueprintVersion());
finishLatch.countDown();
}
};
final StreamObserver<ExecutionServiceInput> requestObserver = asyncStub.process(responseObserver);
try {
// Send our message to CDS backend for processing
requestObserver.onNext(request);
// Mark the end of requests
requestObserver.onCompleted();
} catch (RuntimeException e) {
requestObserver.onError(e);
}
return finishLatch;
}
Aggregations