Interface GrpcClientResponse<Req,Resp>
- All Superinterfaces:
GrpcReadStream<Resp>, ReadStream<Resp>, StreamBase
A response from a gRPC server.
You can set a
messageHandler(Handler) to receive GrpcMessage and a endHandler(Handler) to be notified
of the end of the response.-
Method Summary
Modifier and TypeMethodDescriptionendHandler(Handler<Void> handler) Set an end handler.errorHandler(Handler<GrpcError> handler) Set a handler to be notified with gRPC errors.exceptionHandler(Handler<Throwable> handler) Set an exception handler on the read stream.fetch(long amount) Fetch the specifiedamountof elements.Set a data handler.messageHandler(Handler<GrpcMessage> handler) Set a handler to be notified with incoming encoded messages.pause()Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.request()resume()Resume reading, and sets the buffer inflowingmode.status()trailers()Methods inherited from interface GrpcReadStream
encoding, end, format, headers, invalidMessageHandler, lastMethods inherited from interface ReadStream
blockingStream, collect, pipe, pipeTo
-
Method Details
-
request
GrpcClientRequest<Req,Resp> request()- Returns:
- the associated client request
-
status
GrpcStatus status()- Returns:
- the gRPC status or
nullwhen the status has not yet been received
-
statusMessage
String statusMessage()- Returns:
- the gRPC status message of
nullwhen the status has not yet been received or not transmitted
-
trailers
-
messageHandler
Description copied from interface:GrpcReadStreamSet a handler to be notified with incoming encoded messages. Thehandleris responsible for fully decoding incoming messages, including compression.- Specified by:
messageHandlerin interfaceGrpcReadStream<Req>- Parameters:
handler- the message handler- Returns:
- a reference to this, so the API can be used fluently
-
errorHandler
Description copied from interface:GrpcReadStreamSet a handler to be notified with gRPC errors.- Specified by:
errorHandlerin interfaceGrpcReadStream<Req>- Parameters:
handler- the error handler- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
Description copied from interface:ReadStreamSet an exception handler on the read stream.- Specified by:
exceptionHandlerin interfaceGrpcReadStream<Req>- Specified by:
exceptionHandlerin interfaceReadStream<Req>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
Description copied from interface:ReadStreamSet a data handler. As data is read, the handler will be called with the data.- Specified by:
handlerin interfaceGrpcReadStream<Req>- Specified by:
handlerin interfaceReadStream<Req>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
Description copied from interface:ReadStreamSet an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.- Specified by:
endHandlerin interfaceGrpcReadStream<Req>- Specified by:
endHandlerin interfaceReadStream<Req>- Returns:
- a reference to this, so the API can be used fluently
-
pause
GrpcClientResponse<Req,Resp> pause()Description copied from interface:ReadStreamPause theReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data
handler.- Specified by:
pausein interfaceGrpcReadStream<Req>- Specified by:
pausein interfaceReadStream<Req>- Returns:
- a reference to this, so the API can be used fluently
-
resume
GrpcClientResponse<Req,Resp> resume()Description copied from interface:ReadStreamResume reading, and sets the buffer inflowingmode. If theReadStreamhas been paused, reading will recommence on it.- Specified by:
resumein interfaceGrpcReadStream<Req>- Specified by:
resumein interfaceReadStream<Req>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
Description copied from interface:ReadStreamFetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
fetchin interfaceGrpcReadStream<Req>- Specified by:
fetchin interfaceReadStream<Req>- Returns:
- a reference to this, so the API can be used fluently
-