StreamObserver.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidExecute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().static <T> voidComplete a gRPC request based on the result of aCallable.static <T> voidcomplete(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Complete a gRPC request based on the result of aCompletionStage.static <T> voidcomplete(io.grpc.stub.StreamObserver<T> observer, T value) Complete a gRPC request.static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result) Asynchronously execute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result, Executor executor) Asynchronously execute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable) Asynchronously complete a gRPC request based on the result of aCallable.static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable, Executor executor) Asynchronously complete a gRPC request based on the result of aCallable.static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Asynchronously complete a gRPC request based on the result of aCompletionStage.static <T> voidcompleteAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future, Executor executor) Asynchronously complete a gRPC request based on the result of aCompletionStage.static <U> BiConsumer<Void, Throwable> completeWithoutResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumerthat can be used to complete aStreamObserver.static <T,U> BiConsumer <T, Throwable> completeWithResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method.static <T> Supplier<T> createSupplier(Callable<T> callable) static <T> Consumer<T> stream(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then callStreamObserver.onCompleted().static <T> voidstatic <T> voidstatic <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then asynchronously callStreamObserver.onCompleted()using the fork-join thread pool.static <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage, Executor executor) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then asynchronously callStreamObserver.onCompleted()using the executor thread.static <T> voidstreamAsync(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier, Executor executor) static <T> voidstreamAsync(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream, Executor executor)
-
Method Details
-
complete
public static <T> void complete(io.grpc.stub.StreamObserver<T> observer, T value) Complete a gRPC request.The request will be completed by calling
StreamObserver.onNext(Object)using the specified value then callingStreamObserver.onCompleted().- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completevalue- the value to use when callingStreamObserver.onNext(Object)
-
complete
Complete a gRPC request based on the result of aCompletionStage.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCompletionStageand then callingStreamObserver.onCompleted().If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called.- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completefuture- theCompletionStageto use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future) Asynchronously complete a gRPC request based on the result of aCompletionStage.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCompletionStageand then callingStreamObserver.onCompleted().If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called.The execution will take place asynchronously on the fork-join thread pool.
- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completefuture- theCompletionStageto use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future, Executor executor) Asynchronously complete a gRPC request based on the result of aCompletionStage.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCompletionStageand then callingStreamObserver.onCompleted().If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called.- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completefuture- theCompletionStageto use to obtain the value to use to callStreamObserver.onNext(Object)executor- theExecutoron which to execute the asynchronous request completion
-
complete
Complete a gRPC request based on the result of aCallable.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCallableand then callingStreamObserver.onCompleted().If the
Callable.call()method throws an exception thenStreamObserver.onError(Throwable)will be called.- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completecallable- theCallableto use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
Asynchronously complete a gRPC request based on the result of aCallable.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCallableand then callingStreamObserver.onCompleted().If the
Callable.call()method throws an exception thenStreamObserver.onError(Throwable)will be called.The execution will take place asynchronously on the fork-join thread pool.
- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completecallable- theCallableto use to obtain the value to use to callStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable, Executor executor) Asynchronously complete a gRPC request based on the result of aCallable.The request will be completed by calling
StreamObserver.onNext(Object)using the result obtained on completion of the specifiedCallableand then callingStreamObserver.onCompleted().If the
Callable.call()method throws an exception thenStreamObserver.onError(Throwable)will be called. -
complete
Execute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().If the
Runnable.run()method throws an exception thenStreamObserver.onError(Throwable)will be called.- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completetask- theRunnableto executeresult- the result to pass toStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result) Asynchronously execute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().If the
Runnable.run()method throws an exception thenStreamObserver.onError(Throwable)will be called.The task and and request completion will be executed on the fork-join thread pool.
- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completetask- theRunnableto executeresult- the result to pass toStreamObserver.onNext(Object)
-
completeAsync
public static <T> void completeAsync(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result, Executor executor) Asynchronously execute aRunnabletask and on completion of the task complete the gRPC request by callingStreamObserver.onNext(Object)using the specified result and then callStreamObserver.onCompleted().If the
Runnable.run()method throws an exception thenStreamObserver.onError(Throwable)will be called. -
stream
Send the values from aStreamto theStreamObserver.onNext(Object)method until theStreamis exhausted callStreamObserver.onCompleted().If an error occurs whilst streaming results then
StreamObserver.onError(Throwable)will be called.- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto completestream- theStreamof results to send toStreamObserver.onNext(Object)
-
streamAsync
public static <T> void streamAsync(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream, Executor executor) -
stream
public static <T> void stream(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier) -
streamAsync
public static <T> void streamAsync(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier, Executor executor) -
stream
public static <T> Consumer<T> stream(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then callStreamObserver.onCompleted().If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called instead ofStreamObserver.onCompleted().- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto send values to and complete when theCompletionStagecompletesstage- theCompletionStageto await completion of- Returns:
- a
Consumerthat can be used to send values to theStreamObserver.onNext(Object)method
-
streamAsync
public static <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then asynchronously callStreamObserver.onCompleted()using the fork-join thread pool.If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called instead ofStreamObserver.onCompleted().- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto send values to and complete when theCompletionStagecompletesstage- theCompletionStageto await completion of- Returns:
- a
Consumerthat can be used to send values to theStreamObserver.onNext(Object)method
-
streamAsync
public static <T> Consumer<T> streamAsync(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage, Executor executor) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method until theCompletionStagecompletes then asynchronously callStreamObserver.onCompleted()using the executor thread.If the
CompletionStagecompletes with an error thenStreamObserver.onError(Throwable)will be called instead ofStreamObserver.onCompleted().- Type Parameters:
T- they type of the request result- Parameters:
observer- theStreamObserverto send values to and complete when theCompletionStagecompletesstage- theCompletionStageto await completion ofexecutor- theExecutoron which to execute the asynchronous request completion- Returns:
- a
Consumerthat can be used to send values to theStreamObserver.onNext(Object)method
-
completeWithResult
public static <T,U> BiConsumer<T,Throwable> completeWithResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumerthat can be used to send values to theStreamObserver.onNext(Object)method.- Type Parameters:
T- the type of the resultU- the type of the response- Parameters:
observer- theStreamObserverto complete- Returns:
- a
Consumerthat can be used to send values to theStreamObserver.onNext(Object)method
-
completeWithoutResult
public static <U> BiConsumer<Void,Throwable> completeWithoutResult(io.grpc.stub.StreamObserver<U> observer) Obtain aConsumerthat can be used to complete aStreamObserver.- Type Parameters:
U- the type of the response- Parameters:
observer- theStreamObserverto complete- Returns:
- a
Consumerthat can be used to complete aStreamObserver
-
createSupplier
-