public interface ServerStream extends Stream
Stream
to support server-side termination semantics.
An implementation doesn't need to be thread-safe. All methods are expected to execute quickly.
Modifier and Type | Method and Description |
---|---|
void |
cancel(Status status)
Tears down the stream, typically in the event of a timeout.
|
void |
close(Status status,
Metadata.Trailers trailers)
Closes the stream for both reading and writing.
|
void |
writeHeaders(Metadata.Headers headers)
Writes custom metadata as headers on the response stream sent to the client.
|
flush, isReady, request, writeMessage
void writeHeaders(Metadata.Headers headers)
Stream.writeMessage(java.io.InputStream)
or close(io.grpc.Status, io.grpc.Metadata.Trailers)
.headers
- to send to client.void close(Status status, Metadata.Trailers trailers)
Status.Code.OK
implies normal termination of the
stream. Any other value implies abnormal termination.status
- details of the closuretrailers
- an additional block of metadata to pass to the client on stream closure.void cancel(Status status)