Interface ClientStream

All Superinterfaces:
Stream
All Known Implementing Classes:
AbstractClientStream, FailingClientStream, NoopClientStream

public interface ClientStream extends Stream
Extension of Stream to support client-side termination semantics.

An implementation doesn't need to be thread-safe. All methods are expected to execute quickly.

  • Method Details

    • cancel

      void cancel(Status reason)
      Abnormally terminates the stream. After calling this method, no further messages will be sent or received, however it may still be possible to receive buffered messages for a brief period until ClientStreamListener.closed(io.grpc.Status, io.grpc.internal.ClientStreamListener.RpcProgress, io.grpc.Metadata) is called. This method may only be called after start(io.grpc.internal.ClientStreamListener), but else is safe to be called at any time and multiple times and from any thread.
      Parameters:
      reason - must be non-OK
    • halfClose

      void halfClose()
      Closes the local side of this stream and flushes any remaining messages. After this is called, no further messages may be sent on this stream, but additional messages may be received until the remote end-point is closed. This method may only be called once, and only after start(io.grpc.internal.ClientStreamListener).
    • setAuthority

      void setAuthority(String authority)
      Override the default authority with authority. May only be called before start(io.grpc.internal.ClientStreamListener).
    • setFullStreamDecompression

      void setFullStreamDecompression(boolean fullStreamDecompression)
      Enables full-stream decompression, allowing the client stream to use GzipInflatingBuffer to decode inbound GZIP compressed streams.
    • setDecompressorRegistry

      void setDecompressorRegistry(DecompressorRegistry decompressorRegistry)
      Sets the registry to find a decompressor for the framer. May only be called before start(io.grpc.internal.ClientStreamListener). If the transport does not support compression, this may do nothing.
      Parameters:
      decompressorRegistry - the registry of decompressors for decoding responses
    • start

      void start(ClientStreamListener listener)
      Starts stream. This method may only be called once. It is safe to do latent initialization of the stream up until start(io.grpc.internal.ClientStreamListener) is called.

      This method should not throw any exceptions.

      Parameters:
      listener - non-null listener of stream events
    • setMaxInboundMessageSize

      void setMaxInboundMessageSize(int maxSize)
      Sets the max size accepted from the remote endpoint.
    • setMaxOutboundMessageSize

      void setMaxOutboundMessageSize(int maxSize)
      Sets the max size sent to the remote endpoint.
    • setDeadline

      void setDeadline(@Nonnull Deadline deadline)
      Sets the effective deadline of the RPC.
    • getAttributes

      Attributes getAttributes()
      Attributes that the stream holds at the current moment. Thread-safe and can be called at any time, although some attributes are there only after a certain point.
    • appendTimeoutInsight

      void appendTimeoutInsight(InsightBuilder insight)
      Append information that will be included in the locally generated DEADLINE_EXCEEDED errors to the given InsightBuilder, in order to tell the user about the state of the stream so that they can better diagnose the cause of the error.