Interface GrpcService


  • public interface GrpcService
    A Helidon gRPC service.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <T> void complete​(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result)
      Execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().
      default <T> void complete​(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable)
      Complete a gRPC request based on the result of a Callable.
      default <T> void complete​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future)
      Complete a gRPC request based on the result of a CompletionStage.
      default <T> void complete​(io.grpc.stub.StreamObserver<T> observer, T value)
      Complete a gRPC request.
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result)
      Asynchronously execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, Runnable task, T result, Executor executor)
      Asynchronously execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable)
      Asynchronously complete a gRPC request based on the result of a Callable.
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, Callable<T> callable, Executor executor)
      Asynchronously complete a gRPC request based on the result of a Callable.
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future)
      Asynchronously complete a gRPC request based on the result of a CompletionStage.
      default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<T> future, Executor executor)
      Asynchronously complete a gRPC request based on the result of a CompletionStage.
      default String name()
      Obtain the name of this service.
      default <T> Consumer<T> stream​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage)
      Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then call StreamObserver.onCompleted().
      default <T> void stream​(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier)
      Send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.onCompleted().
      default <T> void stream​(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream)
      Send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.onCompleted().
      default <T> Consumer<T> streamAsync​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage)
      Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then asynchronously call StreamObserver.onCompleted() using the fork-join thread pool.
      default <T> Consumer<T> streamAsync​(io.grpc.stub.StreamObserver<T> observer, CompletionStage<Void> stage, Executor executor)
      Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then asynchronously call StreamObserver.onCompleted() using the executor thread.
      default <T> void streamAsync​(io.grpc.stub.StreamObserver<T> observer, Supplier<Stream<? extends T>> supplier, Executor executor)
      Asynchronously send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.onCompleted().
      default <T> void streamAsync​(io.grpc.stub.StreamObserver<T> observer, Stream<? extends T> stream, Executor executor)
      Asynchronously send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.onCompleted().
      void update​(ServiceDescriptor.Rules rules)
      Update service configuration.
    • Method Detail

      • update

        void update​(ServiceDescriptor.Rules rules)
        Update service configuration.
        Parameters:
        rules - configuration to update
      • name

        default String name()
        Obtain the name of this service.

        The default implementation returns the implementation class's Class.getSimpleName().

        Returns:
        the name of this service
      • complete

        default <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 calling StreamObserver.onCompleted().

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        value - the value to use when calling StreamObserver.onNext(Object)
      • complete

        default <T> void complete​(io.grpc.stub.StreamObserver<T> observer,
                                  CompletionStage<T> future)
        Complete a gRPC request based on the result of a CompletionStage.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified CompletionStage and then calling StreamObserver.onCompleted().

        If the CompletionStage completes with an error then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        future - the CompletionStage to use to obtain the value to use to call StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       CompletionStage<T> future)
        Asynchronously complete a gRPC request based on the result of a CompletionStage.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified CompletionStage and then calling StreamObserver.onCompleted().

        If the CompletionStage completes with an error then StreamObserver.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 - the StreamObserver to complete
        future - the CompletionStage to use to obtain the value to use to call StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       CompletionStage<T> future,
                                       Executor executor)
        Asynchronously complete a gRPC request based on the result of a CompletionStage.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified CompletionStage and then calling StreamObserver.onCompleted().

        If the CompletionStage completes with an error then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        future - the CompletionStage to use to obtain the value to use to call StreamObserver.onNext(Object)
        executor - the Executor on which to execute the asynchronous request completion
      • complete

        default <T> void complete​(io.grpc.stub.StreamObserver<T> observer,
                                  Callable<T> callable)
        Complete a gRPC request based on the result of a Callable.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified Callable and then calling StreamObserver.onCompleted().

        If the Callable.call() method throws an exception then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        callable - the Callable to use to obtain the value to use to call StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       Callable<T> callable)
        Asynchronously complete a gRPC request based on the result of a Callable.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified Callable and then calling StreamObserver.onCompleted().

        If the Callable.call() method throws an exception then StreamObserver.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 - the StreamObserver to complete
        callable - the Callable to use to obtain the value to use to call StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       Callable<T> callable,
                                       Executor executor)
        Asynchronously complete a gRPC request based on the result of a Callable.

        The request will be completed by calling StreamObserver.onNext(Object) using the result obtained on completion of the specified Callable and then calling StreamObserver.onCompleted().

        If the Callable.call() method throws an exception then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        callable - the Callable to use to obtain the value to use to call StreamObserver.onNext(Object)
        executor - the Executor on which to execute the asynchronous request completion
      • complete

        default <T> void complete​(io.grpc.stub.StreamObserver<T> observer,
                                  Runnable task,
                                  T result)
        Execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().

        If the Runnable.run() method throws an exception then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        task - the Runnable to execute
        result - the result to pass to StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       Runnable task,
                                       T result)
        Asynchronously execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().

        If the Runnable.run() method throws an exception then StreamObserver.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 - the StreamObserver to complete
        task - the Runnable to execute
        result - the result to pass to StreamObserver.onNext(Object)
      • completeAsync

        default <T> void completeAsync​(io.grpc.stub.StreamObserver<T> observer,
                                       Runnable task,
                                       T result,
                                       Executor executor)
        Asynchronously execute a Runnable task and on completion of the task complete the gRPC request by calling StreamObserver.onNext(Object) using the specified result and then call StreamObserver.onCompleted().

        If the Runnable.run() method throws an exception then StreamObserver.onError(Throwable) will be called.

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to complete
        task - the Runnable to execute
        result - the result to pass to StreamObserver.onNext(Object)
        executor - the Executor on which to execute the asynchronous request completion
      • stream

        default <T> void stream​(io.grpc.stub.StreamObserver<T> observer,
                                Stream<? extends T> stream)
        Send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.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 - the StreamObserver to complete
        stream - the Stream of results to send to StreamObserver.onNext(Object)
      • streamAsync

        default <T> void streamAsync​(io.grpc.stub.StreamObserver<T> observer,
                                     Stream<? extends T> stream,
                                     Executor executor)
        Asynchronously send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.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 - the StreamObserver to complete
        stream - the Stream of results to send to StreamObserver.onNext(Object)
        executor - the Executor on which to execute the asynchronous request completion
      • stream

        default <T> void stream​(io.grpc.stub.StreamObserver<T> observer,
                                Supplier<Stream<? extends T>> supplier)
        Send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.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 - the StreamObserver to complete
        supplier - the Supplier of the Stream of results to send to StreamObserver.onNext(Object)
      • streamAsync

        default <T> void streamAsync​(io.grpc.stub.StreamObserver<T> observer,
                                     Supplier<Stream<? extends T>> supplier,
                                     Executor executor)
        Asynchronously send the values from a Stream to the StreamObserver.onNext(Object) method until the Stream is exhausted call StreamObserver.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 - the StreamObserver to complete
        supplier - the Supplier of the Stream of results to send to StreamObserver.onNext(Object)
        executor - the Executor on which to execute the asynchronous request completion
      • stream

        default <T> Consumer<T> stream​(io.grpc.stub.StreamObserver<T> observer,
                                       CompletionStage<Void> stage)
        Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then call StreamObserver.onCompleted().

        If the CompletionStage completes with an error then StreamObserver.onError(Throwable) will be called instead of StreamObserver.onCompleted().

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to send values to and complete when the CompletionStage completes
        stage - the CompletionStage to await completion of
        Returns:
        a Consumer that can be used to send values to the StreamObserver.onNext(Object) method
      • streamAsync

        default <T> Consumer<T> streamAsync​(io.grpc.stub.StreamObserver<T> observer,
                                            CompletionStage<Void> stage)
        Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then asynchronously call StreamObserver.onCompleted() using the fork-join thread pool.

        If the CompletionStage completes with an error then StreamObserver.onError(Throwable) will be called instead of StreamObserver.onCompleted().

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to send values to and complete when the CompletionStage completes
        stage - the CompletionStage to await completion of
        Returns:
        a Consumer that can be used to send values to the StreamObserver.onNext(Object) method
      • streamAsync

        default <T> Consumer<T> streamAsync​(io.grpc.stub.StreamObserver<T> observer,
                                            CompletionStage<Void> stage,
                                            Executor executor)
        Obtain a Consumer that can be used to send values to the StreamObserver.onNext(Object) method until the CompletionStage completes then asynchronously call StreamObserver.onCompleted() using the executor thread.

        If the CompletionStage completes with an error then StreamObserver.onError(Throwable) will be called instead of StreamObserver.onCompleted().

        Type Parameters:
        T - they type of the request result
        Parameters:
        observer - the StreamObserver to send values to and complete when the CompletionStage completes
        stage - the CompletionStage to await completion of
        executor - the Executor on which to execute the asynchronous request completion
        Returns:
        a Consumer that can be used to send values to the StreamObserver.onNext(Object) method