Class CallbackStreamObserver<ResponseT extends com.google.protobuf.Message>

  • Type Parameters:
    ResponseT - The proto2 message that gRPC will receive as a successful response.
    All Implemented Interfaces:
    io.grpc.stub.StreamObserver<ResponseT>

    public class CallbackStreamObserver<ResponseT extends com.google.protobuf.Message>
    extends Object
    implements io.grpc.stub.StreamObserver<ResponseT>
    gRPC client-side stream observer that converts the received RPC response into a call on the supplied AnyRpcCallback.
    • Method Detail

      • of

        public static <ResponseT extends com.google.protobuf.Message> CallbackStreamObserver<ResponseT> of​(GrpcClientContext clientContext,
                                                                                                           AnyRpcCallback<ResponseT> anyRpcCallback)
        Returns a StreamObserver that will convert gRPC responses into calls on the given anyRpcCallback.
        Parameters:
        clientContext - the context that will be updated with success or failure details when the RPC completes
        anyRpcCallback - the callback that will be invoked when the RPC completes
      • onNext

        public void onNext​(ResponseT grpcResponse)
        Specified by:
        onNext in interface io.grpc.stub.StreamObserver<ResponseT extends com.google.protobuf.Message>
      • onError

        public void onError​(Throwable throwable)
        Specified by:
        onError in interface io.grpc.stub.StreamObserver<ResponseT extends com.google.protobuf.Message>
      • onCompleted

        public void onCompleted()
        Specified by:
        onCompleted in interface io.grpc.stub.StreamObserver<ResponseT extends com.google.protobuf.Message>