use of alluxio.hub.proto.UploadFileResponse in project alluxio by Alluxio.
the class ManagerProcessContext method startUploadFileListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} UploadFile RPC calls.
*/
public void startUploadFileListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<UploadFileRequest, UploadFileResponse>() {
@Override
public UploadFileResponse exec(UploadFileRequest req) {
boolean success = uploadFile(req.getPayload().getFileList());
return UploadFileResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(UploadFileResponse.Payload.newBuilder().setSuccess(success)).build();
}
@Override
public void restart() {
startUploadFileListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<UploadFileResponse> responseObserver = asyncStub.uploadFile(requestObserver);
requestObserver.start(responseObserver, UploadFileResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started UploadFile async listener", asyncStub);
}
Aggregations