Class CollectingObserver<T,V,U,A,R>

java.lang.Object
io.helidon.grpc.core.CollectingObserver<T,V,U,A,R>
Type Parameters:
T - the type of input elements to the reduction operation
V - the request type before conversion
U - the type of values observed
A - the mutable accumulation type of the reduction operation
R - the result type of the reduction operation
All Implemented Interfaces:
io.grpc.stub.StreamObserver<V>

public class CollectingObserver<T,V,U,A,R> extends Object implements io.grpc.stub.StreamObserver<V>
Utility StreamObserver mostly used for testing.
  • Method Details

    • create

      public static <T, V, U, A, R> CollectingObserver<T,V,U,A,R> create(Collector<T,A,R> collector, io.grpc.stub.StreamObserver<U> observer)
      Creates collecting observer from a collector and another observer.
      Type Parameters:
      T - the type of input elements to the reduction operation
      V - the request type before conversion
      U - the type of values observed
      A - the mutable accumulation type of the reduction operation
      R - the result type of the reduction operation
      Parameters:
      collector - the collector
      observer - the observer
      Returns:
      new collecting observer
    • create

      public static <T, V, U, A, R> CollectingObserver<T,V,U,A,R> create(Collector<T,A,R> collector, io.grpc.stub.StreamObserver<U> observer, Consumer<Throwable> errorHandler)
      Creates collecting observer from a collector, another observer and an error handler.
      Type Parameters:
      T - the type of input elements to the reduction operation
      V - the request type before conversion
      U - the type of values observed
      A - the mutable accumulation type of the reduction operation
      R - the result type of the reduction operation
      Parameters:
      collector - the collector
      observer - the observer
      errorHandler - the error handler
      Returns:
      new collecting observer
    • create

      public static <T, V, U, A, R> CollectingObserver<T,V,U,A,R> create(Collector<T,A,R> collector, io.grpc.stub.StreamObserver<U> observer, Function<V,T> requestConverter, Function<R,U> responseConverter)
      Creates collecting observer from a collector, another observer and converters.
      Type Parameters:
      T - the type of input elements to the reduction operation
      V - the request type before conversion
      U - the type of values observed
      A - the mutable accumulation type of the reduction operation
      R - the result type of the reduction operation
      Parameters:
      collector - the collector
      observer - the observer
      requestConverter - request converter
      responseConverter - response converter
      Returns:
      new collecting observer
    • onNext

      public void onNext(V value)
      Specified by:
      onNext in interface io.grpc.stub.StreamObserver<T>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface io.grpc.stub.StreamObserver<T>
    • onCompleted

      public void onCompleted()
      Specified by:
      onCompleted in interface io.grpc.stub.StreamObserver<T>