grpc 使用流程、使用技巧

1、通过maven插件编译出java stub类。

2、对于批量调用的场景,我们可以使用FutureStub,对于普通的业务类型RPC,我们应该使用BlockingStub。

3、创建批量生成多个语言脚本,做成bat命令。

@rem 生成客户端和服务器端存根

setlocal

@rem 进入当前目录
cd /d %~dp0

set TOOLS_PATH=C:UsersFreeman.nugetpackagesGrpc.Tools1.0.0	oolswindows_x86

%TOOLS_PATH%protoc.exe ^
--proto_path protos ^
--cpp_out=Interfaces/cpp ^
--csharp_out=Interfaces/csharp ^
--java_out=Interfaces/java ^
--js_out=Interfaces/javascript ^
--grpc_out=Interfaces/csharp ^
--plugin=protoc-gen-grpc=%TOOLS_PATH%grpc_csharp_plugin.exe ^
protos/mathservice.proto

endlocal
timeout 5

  grpc一篇好文章。

  http://shift-alt-ctrl.iteye.com/blog/2292862

  http://www.jianshu.com/p/f5e1c002047a

原文地址:https://www.cnblogs.com/freedommovie/p/6802974.html