ReqT
- type of the requestResT
- type of the response@NotThreadSafe public class GrpcDataMessageBlockingStream<ReqT,ResT> extends GrpcBlockingStream<ReqT,ResT>
Constructor and Description |
---|
GrpcDataMessageBlockingStream(java.util.function.Function<io.grpc.stub.StreamObserver<ResT>,io.grpc.stub.StreamObserver<ReqT>> rpcFunc,
int bufferSize,
String description,
DataMessageMarshaller<ReqT> requestMarshaller,
DataMessageMarshaller<ResT> responseMarshaller) |
Modifier and Type | Method and Description |
---|---|
ResT |
receive(long timeoutMs)
Receives a response from the server.
|
DataMessage<ResT,DataBuffer> |
receiveDataMessage(long timeoutMs)
Receives a response with data buffer from the server.
|
void |
sendDataMessage(DataMessage<ReqT,DataBuffer> message,
long timeoutMs)
Sends a request.
|
Optional<ResT> |
waitForComplete(long timeoutMs)
Wait for server to complete the inbound stream.
|
cancel, close, isCanceled, isClosed, isOpen, send, send
public GrpcDataMessageBlockingStream(java.util.function.Function<io.grpc.stub.StreamObserver<ResT>,io.grpc.stub.StreamObserver<ReqT>> rpcFunc, int bufferSize, String description, DataMessageMarshaller<ReqT> requestMarshaller, DataMessageMarshaller<ResT> responseMarshaller)
rpcFunc
- the gRPC bi-directional stream stub functionbufferSize
- maximum number of incoming messages the buffer can holddescription
- description of this streamrequestMarshaller
- the marshaller for the requestresponseMarshaller
- the marshaller for the responsepublic ResT receive(long timeoutMs) throws IOException
GrpcBlockingStream
receive
in class GrpcBlockingStream<ReqT,ResT>
timeoutMs
- maximum time to wait before giving up and throwing
a DeadlineExceededException
IOException
- if any error occurspublic DataMessage<ResT,DataBuffer> receiveDataMessage(long timeoutMs) throws IOException
timeoutMs
- maximum time to wait before giving up and throwing
a DeadlineExceededException
IOException
- if any error occurspublic void sendDataMessage(DataMessage<ReqT,DataBuffer> message, long timeoutMs) throws IOException
message
- the request message with attached
timeoutMs
- maximum wait time before throwing a DeadlineExceededException
IOException
- if any error occurspublic Optional<ResT> waitForComplete(long timeoutMs) throws IOException
GrpcBlockingStream
waitForComplete
in class GrpcBlockingStream<ReqT,ResT>
timeoutMs
- maximum time to wait for server responseIOException
Copyright © 2023. All Rights Reserved.