Search in sources :

Example 1 with ProcessStatusChangeResponse

use of alluxio.hub.proto.ProcessStatusChangeResponse in project alluxio by Alluxio.

the class ManagerProcessContext method startProcessStatusChangeListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} ProcessStatusChange
 * RPC calls.
 */
public void startProcessStatusChangeListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<ProcessStatusChangeRequest, ProcessStatusChangeResponse>() {

        @Override
        public ProcessStatusChangeResponse exec(ProcessStatusChangeRequest req) {
            return ProcessStatusChangeResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ProcessStatusChangeResponse.Payload.newBuilder().addAllProcessStatusChangeResponse(processStatusChange(req))).build();
        }

        @Override
        public void restart() {
            startProcessStatusChangeListener();
        }

        @Override
        public void handleError(String message, Throwable t) {
            handleStatusRuntimeException(message, t);
        }
    };
    StreamObserver<ProcessStatusChangeResponse> responseObserver = asyncStub.processStatusChange(requestObserver);
    requestObserver.start(responseObserver, ProcessStatusChangeResponse.newBuilder().setHubMetadata(mHubMetadata).build());
    LOG.info("Started ProcessStatusChange async listener", asyncStub);
}
Also used : AgentProcessStatusChangeResponse(alluxio.hub.proto.AgentProcessStatusChangeResponse) ProcessStatusChangeResponse(alluxio.hub.proto.ProcessStatusChangeResponse) RequestStreamObserver(alluxio.hub.manager.rpc.observer.RequestStreamObserver) ProcessStatusChangeRequest(alluxio.hub.proto.ProcessStatusChangeRequest) HostedManagerServiceGrpc(alluxio.hub.proto.HostedManagerServiceGrpc) ByteString(com.google.protobuf.ByteString)

Aggregations

RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentProcessStatusChangeResponse (alluxio.hub.proto.AgentProcessStatusChangeResponse)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 ProcessStatusChangeRequest (alluxio.hub.proto.ProcessStatusChangeRequest)1 ProcessStatusChangeResponse (alluxio.hub.proto.ProcessStatusChangeResponse)1 ByteString (com.google.protobuf.ByteString)1