Package io.helidon.grpc.client
Class GrpcServiceClient.SingleValueStreamObserver<T>
- java.lang.Object
-
- io.helidon.grpc.client.GrpcServiceClient.SingleValueStreamObserver<T>
-
- Type Parameters:
T
- The type of objects received in this stream.
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>
- Enclosing class:
- GrpcServiceClient
public static class GrpcServiceClient.SingleValueStreamObserver<T> extends Object implements io.grpc.stub.StreamObserver<T>
A simpleStreamObserver
adapter class that completes aCompletableFuture
when the observer is completed.This observer uses the value passed to its
onNext(Object)
method to complete theCompletableFuture
.This observer should only be used in cases where a single result is expected. If more that one call is made to
onNext(Object)
then future will be completed with an exception.
-
-
Constructor Summary
Constructors Constructor Description SingleValueStreamObserver()
Create a SingleValueStreamObserver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<T>
completionStage()
Obtain theCompletableFuture
that will be completed when theStreamObserver
completes.void
onCompleted()
void
onError(Throwable t)
void
onNext(T value)
-
-
-
Method Detail
-
completionStage
public CompletionStage<T> completionStage()
Obtain theCompletableFuture
that will be completed when theStreamObserver
completes.- Returns:
- The CompletableFuture
-
onNext
public void onNext(T value)
- Specified by:
onNext
in interfaceio.grpc.stub.StreamObserver<T>
-
onError
public void onError(Throwable t)
- Specified by:
onError
in interfaceio.grpc.stub.StreamObserver<T>
-
onCompleted
public void onCompleted()
- Specified by:
onCompleted
in interfaceio.grpc.stub.StreamObserver<T>
-
-