Add unary call mode to GenericStub to allow generic RPC with 1 CQ trip
diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc
index de2e449..693b8be 100644
--- a/src/cpp/client/generic_stub.cc
+++ b/src/cpp/client/generic_stub.cc
@@ -47,4 +47,14 @@
return CallInternal(channel_.get(), context, method, cq, false, nullptr);
}
+// setup a unary call to a named method
+std::unique_ptr<GenericClientAsyncResponseReader> GenericStub::PrepareUnaryCall(
+ ClientContext* context, const grpc::string& method,
+ const ByteBuffer& request, CompletionQueue* cq) {
+ return std::unique_ptr<GenericClientAsyncResponseReader>(
+ GenericClientAsyncResponseReader::Create(
+ channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::NORMAL_RPC),
+ context, request, false));
+}
+
} // namespace grpc