Interface StreamObserver<T>

Type Parameters:
T - the message type

public interface StreamObserver<T>

Receives the messages of a stream: the responses a streaming handler sends, or the responses a client reads from a streaming call.

A handler calls onNext(T) once per message and ends the call with exactly one of onCompleted() or onError(Throwable). Returning from a server streaming handler without either completes the call with OK.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Ends the stream with OK.
    void
    Ends the stream with an error.
    void
    onNext(T value)
    Sends (or receives) one message.
  • Method Details

    • onNext

      void onNext(T value)
      Sends (or receives) one message.
      Parameters:
      value - the message
    • onError

      void onError(Throwable error)
      Ends the stream with an error. A GrpcException carries its status; anything else ends the call with UNKNOWN.
      Parameters:
      error - the failure
    • onCompleted

      void onCompleted()
      Ends the stream with OK.