Ale*_*hen 8 java protocol-buffers grpc
我是gRPC的新手并遇到这个问题:我用rpc服务定义创建了一个.proto.编译后我得到生成的源:所有消息都有一个实现接口的类.但是,服务本身并不实现任何接口 - 它根本就不会生成.这就是我应该在我的服务器中实现的接口.我究竟做错了什么?我很确定gRPC文档没有说明这个问题.
我的.proto服务:
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.blah.my.rpc.api";
option java_outer_classname = "MyServiceProto";
option objc_class_prefix = "Pb";
package com.blah.my.rpc.api;
service MyService
{
rpc connect(PbEmptyMessage) returns (PbParameterGroup){}
rpc getParams(PbGenList) returns (PbParameterGroup){}
}
message PbEmptyMessage
{
}
message PbGenId
{
string paramName = 1;
string systemName = 2;
string sName = 3;
string sId = 4;
}
message PbParameterGroup
{
bytes sParameters = 2;
fixed64 time = 3;
}
Run Code Online (Sandbox Code Playgroud)
我在maven中的插件定义:
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.0.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.0.0-beta-2:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:0.14.0:exe:${os.detected.classifier}</pluginArtifact>
<protoSourceRoot>${basedir}/src/main/resources</protoSourceRoot>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2328 次 |
最近记录: |