首页  

grpc实例     所属分类 grpc 浏览量 441
https://gitee.com/dyyx/hellocode/tree/master/demo/grpc-demo


maven protobuf 插件生成 grpc 相关文件

protobuf:compile
protobuf:compile-custom


protobuf:compile
生成消息文件
target/generated-sources/protobuf/java
HelloReply
HelloReplyOrBuilder
HelloRequest
HelloRequestOrBuilder
HelloWorldProto

protobuf:compile-custom
生成接口服务文件
target/generated-sources/protobuf/grpc-java
GreeterGrpc


把 java 和 grpc-java 两个目录标记为源码目录


src/main/proto/helloworld.proto syntax = "proto3"; option java_multiple_files = true; option java_package = "io.grpc.examples.helloworld"; option java_outer_classname = "HelloWorldProto"; option objc_class_prefix = "HLW"; package helloworld; // The greeting service definition. service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply) {} } // The request message containing the user's name. message HelloRequest { string name = 1; } // The response message containing the greetings message HelloReply { string message = 1; }
先运行 HelloWorldServer 再启动 HelloWorldClient
idea设置源码目录 protobuf 简介 及 java实例 maven插件编译proto文件

上一篇     下一篇
经典粤语歌

git pull 报错 HTTP Basic: Access denied

grpc简介

快乐因子多巴胺分泌排行

康波周期

密码学基础