S
- the type of the protobuf Service you want to call.R
- the type of the return value.@InterfaceAudience.Public @FunctionalInterface public interface ServiceCaller<S,R>
Usually, it is just a simple lambda expression, like:
(stub, controller, rpcCallback) -> {
XXXRequest request = ...; // prepare the request
stub.xxx(controller, request, rpcCallback);
}
And if already have the request
, the lambda expression will be:
(stub, controller, rpcCallback) -> stub.xxx(controller, request, rpcCallback)
Modifier and Type | Method and Description |
---|---|
void |
call(S stub,
com.google.protobuf.RpcController controller,
com.google.protobuf.RpcCallback<R> rpcCallback)
Represent the actual protobuf rpc call.
|
void call(S stub, com.google.protobuf.RpcController controller, com.google.protobuf.RpcCallback<R> rpcCallback)
stub
- the asynchronous stubcontroller
- the rpc controller, has already been prepared for yourpcCallback
- the rpc callback, has already been prepared for youCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.