public interface GrpcServerResponse<Req,Resp> extends GrpcWriteStream<Resp>
Modifier and Type | Method and Description |
---|---|
GrpcServerResponse<Req,Resp> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcServerResponse<Req,Resp> |
encoding(String encoding)
Set the stream encoding, e.g
identity or gzip . |
GrpcServerResponse<Req,Resp> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
default Future<Void> |
send(ReadStream<Resp> body) |
default Future<Void> |
send(Resp item) |
GrpcServerResponse<Req,Resp> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
GrpcServerResponse<Req,Resp> |
status(GrpcStatus status)
Set the grpc status response
|
GrpcServerResponse<Req,Resp> |
statusMessage(String msg)
Set the grpc status response message
|
MultiMap |
trailers() |
cancel, endMessage, headers, writeMessage
end, end, end, end, write, write, writeQueueFull
GrpcServerResponse<Req,Resp> status(GrpcStatus status)
status
- the statusGrpcServerResponse<Req,Resp> statusMessage(String msg)
msg
- the messageGrpcServerResponse<Req,Resp> encoding(String encoding)
GrpcWriteStream
identity
or gzip
.
It must be called before sending any message, otherwise {@code identity will be used.encoding
in interface GrpcWriteStream<Resp>
encoding
- the target message encodingGrpcServerResponse<Req,Resp> exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface GrpcWriteStream<Resp>
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<Resp>
handler
- the exception handlerGrpcServerResponse<Req,Resp> setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. You will still be able to write to the stream even
if there is more than maxSize
items in the write queue. This is used as an indicator by classes such as
Pipe
to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket
, etc...setWriteQueueMaxSize
in interface GrpcWriteStream<Resp>
setWriteQueueMaxSize
in interface WriteStream<Resp>
maxSize
- the max size of the write streamGrpcServerResponse<Req,Resp> drainHandler(Handler<Void> handler)
WriteStream
Pipe
for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2
.
drainHandler
in interface GrpcWriteStream<Resp>
drainHandler
in interface WriteStream<Resp>
handler
- the handlerdefault Future<Void> send(ReadStream<Resp> body)
Copyright © 2024 Eclipse. All rights reserved.