Interface ServiceCaller<S,R>

Type Parameters:
S - the type of the protobuf Service you want to call.
R - the type of the return value.
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Public @FunctionalInterface public interface ServiceCaller<S,R>
Delegate to a protobuf rpc call.

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)
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    call(S stub, com.google.protobuf.RpcController controller, com.google.protobuf.RpcCallback<R> rpcCallback)
    Represent the actual protobuf rpc call.
  • Method Details

    • call

      void call(S stub, com.google.protobuf.RpcController controller, com.google.protobuf.RpcCallback<R> rpcCallback)
      Represent the actual protobuf rpc call.
      Parameters:
      stub - the asynchronous stub
      controller - the rpc controller, has already been prepared for you
      rpcCallback - the rpc callback, has already been prepared for you