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)
Closes the stream for both reading and writing.
|
Attributes |
getAttributes()
Attributes describing stream.
|
String |
getAuthority()
Gets the authority this stream is addressed to.
|
void |
setDecompressor(Decompressor decompressor)
Sets the decompressor on the deframer.
|
void |
setListener(ServerStreamListener serverStreamListener)
Sets the server stream listener.
|
StatsTraceContext |
statsTraceContext()
The context for recording stats and traces for this stream.
|
void |
writeHeaders(Metadata headers)
Writes custom metadata as headers on the response stream sent to the client.
|
flush, isReady, request, setCompressor, setMessageCompression, writeMessage
void writeHeaders(Metadata headers)
Stream.writeMessage(java.io.InputStream)
or close(io.grpc.Status, io.grpc.Metadata)
.headers
- to send to client.void close(Status status, Metadata trailers)
Status.Code.OK
implies normal termination of the
stream. Any other value implies abnormal termination.
Attempts to read from or write to the stream after closing should be ignored by implementations, and should not throw exceptions.
status
- details of the closuretrailers
- an additional block of metadata to pass to the client on stream closure.void cancel(Status status)
void setDecompressor(Decompressor decompressor)
decompressor
- the decompressor to use.Attributes getAttributes()
ServerCall.getAttributes()
.@Nullable String getAuthority()
null
if not available.void setListener(ServerStreamListener serverStreamListener)
StatsTraceContext statsTraceContext()