Partially synchronize helloworld.proto with main repository

Mainly HelloResponse is now HelloReply
This commit is contained in:
Eric Anderson 2016-02-02 12:54:04 -08:00
parent 4573836df9
commit 2a17d2648c
12 changed files with 108 additions and 107 deletions

View File

@ -23,13 +23,13 @@ public class GreeterGrpc {
// Static method descriptors that strictly reflect the proto.
@io.grpc.ExperimentalApi
public static final io.grpc.MethodDescriptor<io.grpc.examples.helloworld.HelloRequest,
io.grpc.examples.helloworld.HelloResponse> METHOD_SAY_HELLO =
io.grpc.examples.helloworld.HelloReply> METHOD_SAY_HELLO =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.UNARY,
generateFullMethodName(
"helloworld.Greeter", "SayHello"),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.examples.helloworld.HelloRequest.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.examples.helloworld.HelloResponse.getDefaultInstance()));
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.examples.helloworld.HelloReply.getDefaultInstance()));
public static GreeterStub newStub(io.grpc.Channel channel) {
return new GreeterStub(channel);
@ -48,17 +48,17 @@ public class GreeterGrpc {
public static interface Greeter {
public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloResponse> responseObserver);
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply> responseObserver);
}
public static interface GreeterBlockingClient {
public io.grpc.examples.helloworld.HelloResponse sayHello(io.grpc.examples.helloworld.HelloRequest request);
public io.grpc.examples.helloworld.HelloReply sayHello(io.grpc.examples.helloworld.HelloRequest request);
}
public static interface GreeterFutureClient {
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloResponse> sayHello(
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloReply> sayHello(
io.grpc.examples.helloworld.HelloRequest request);
}
@ -81,7 +81,7 @@ public class GreeterGrpc {
@java.lang.Override
public void sayHello(io.grpc.examples.helloworld.HelloRequest request,
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloResponse> responseObserver) {
io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request, responseObserver);
}
@ -105,7 +105,7 @@ public class GreeterGrpc {
}
@java.lang.Override
public io.grpc.examples.helloworld.HelloResponse sayHello(io.grpc.examples.helloworld.HelloRequest request) {
public io.grpc.examples.helloworld.HelloReply sayHello(io.grpc.examples.helloworld.HelloRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_SAY_HELLO, getCallOptions(), request);
}
@ -129,7 +129,7 @@ public class GreeterGrpc {
}
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloResponse> sayHello(
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.helloworld.HelloReply> sayHello(
io.grpc.examples.helloworld.HelloRequest request) {
return futureUnaryCall(
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request);
@ -156,7 +156,7 @@ public class GreeterGrpc {
switch (methodId) {
case METHODID_SAY_HELLO:
serviceImpl.sayHello((io.grpc.examples.helloworld.HelloRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloResponse>) responseObserver);
(io.grpc.stub.StreamObserver<io.grpc.examples.helloworld.HelloReply>) responseObserver);
break;
default:
throw new AssertionError();
@ -181,7 +181,7 @@ public class GreeterGrpc {
asyncUnaryCall(
new MethodHandlers<
io.grpc.examples.helloworld.HelloRequest,
io.grpc.examples.helloworld.HelloResponse>(
io.grpc.examples.helloworld.HelloReply>(
serviceImpl, METHODID_SAY_HELLO)))
.build();
}

View File

@ -1,24 +1,24 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello_world.proto
// source: helloworld.proto
package io.grpc.examples.helloworld;
/**
* Protobuf type {@code helloworld.HelloResponse}
* Protobuf type {@code helloworld.HelloReply}
*
* <pre>
* The response message containing the greetings
* </pre>
*/
public final class HelloResponse extends
public final class HelloReply extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:helloworld.HelloResponse)
HelloResponseOrBuilder {
// Use HelloResponse.newBuilder() to construct.
private HelloResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
// @@protoc_insertion_point(message_implements:helloworld.HelloReply)
HelloReplyOrBuilder {
// Use HelloReply.newBuilder() to construct.
private HelloReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
}
private HelloResponse() {
private HelloReply() {
message_ = "";
}
@ -27,7 +27,7 @@ public final class HelloResponse extends
getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
}
private HelloResponse(
private HelloReply(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) {
this();
@ -66,14 +66,14 @@ public final class HelloResponse extends
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloResponse_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloResponse_fieldAccessorTable
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.examples.helloworld.HelloResponse.class, io.grpc.examples.helloworld.HelloResponse.Builder.class);
io.grpc.examples.helloworld.HelloReply.class, io.grpc.examples.helloworld.HelloReply.Builder.class);
}
public static final int MESSAGE_FIELD_NUMBER = 1;
@ -140,53 +140,53 @@ public final class HelloResponse extends
}
private static final long serialVersionUID = 0L;
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(byte[] data)
public static io.grpc.examples.helloworld.HelloReply parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(java.io.InputStream input)
public static io.grpc.examples.helloworld.HelloReply parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static io.grpc.examples.helloworld.HelloResponse parseDelimitedFrom(java.io.InputStream input)
public static io.grpc.examples.helloworld.HelloReply parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static io.grpc.examples.helloworld.HelloResponse parseDelimitedFrom(
public static io.grpc.examples.helloworld.HelloReply parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static io.grpc.examples.helloworld.HelloResponse parseFrom(
public static io.grpc.examples.helloworld.HelloReply parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
@ -197,7 +197,7 @@ public final class HelloResponse extends
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.examples.helloworld.HelloResponse prototype) {
public static Builder newBuilder(io.grpc.examples.helloworld.HelloReply prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
@ -212,7 +212,7 @@ public final class HelloResponse extends
return builder;
}
/**
* Protobuf type {@code helloworld.HelloResponse}
* Protobuf type {@code helloworld.HelloReply}
*
* <pre>
* The response message containing the greetings
@ -220,21 +220,21 @@ public final class HelloResponse extends
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:helloworld.HelloResponse)
io.grpc.examples.helloworld.HelloResponseOrBuilder {
// @@protoc_insertion_point(builder_implements:helloworld.HelloReply)
io.grpc.examples.helloworld.HelloReplyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloResponse_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloResponse_fieldAccessorTable
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.examples.helloworld.HelloResponse.class, io.grpc.examples.helloworld.HelloResponse.Builder.class);
io.grpc.examples.helloworld.HelloReply.class, io.grpc.examples.helloworld.HelloReply.Builder.class);
}
// Construct using io.grpc.examples.helloworld.HelloResponse.newBuilder()
// Construct using io.grpc.examples.helloworld.HelloReply.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
@ -257,39 +257,39 @@ public final class HelloResponse extends
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloResponse_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloReply_descriptor;
}
public io.grpc.examples.helloworld.HelloResponse getDefaultInstanceForType() {
return io.grpc.examples.helloworld.HelloResponse.getDefaultInstance();
public io.grpc.examples.helloworld.HelloReply getDefaultInstanceForType() {
return io.grpc.examples.helloworld.HelloReply.getDefaultInstance();
}
public io.grpc.examples.helloworld.HelloResponse build() {
io.grpc.examples.helloworld.HelloResponse result = buildPartial();
public io.grpc.examples.helloworld.HelloReply build() {
io.grpc.examples.helloworld.HelloReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.examples.helloworld.HelloResponse buildPartial() {
io.grpc.examples.helloworld.HelloResponse result = new io.grpc.examples.helloworld.HelloResponse(this);
public io.grpc.examples.helloworld.HelloReply buildPartial() {
io.grpc.examples.helloworld.HelloReply result = new io.grpc.examples.helloworld.HelloReply(this);
result.message_ = message_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.examples.helloworld.HelloResponse) {
return mergeFrom((io.grpc.examples.helloworld.HelloResponse)other);
if (other instanceof io.grpc.examples.helloworld.HelloReply) {
return mergeFrom((io.grpc.examples.helloworld.HelloReply)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.examples.helloworld.HelloResponse other) {
if (other == io.grpc.examples.helloworld.HelloResponse.getDefaultInstance()) return this;
public Builder mergeFrom(io.grpc.examples.helloworld.HelloReply other) {
if (other == io.grpc.examples.helloworld.HelloReply.getDefaultInstance()) return this;
if (!other.getMessage().isEmpty()) {
message_ = other.message_;
onChanged();
@ -306,11 +306,11 @@ public final class HelloResponse extends
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.examples.helloworld.HelloResponse parsedMessage = null;
io.grpc.examples.helloworld.HelloReply parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.examples.helloworld.HelloResponse) e.getUnfinishedMessage();
parsedMessage = (io.grpc.examples.helloworld.HelloReply) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
@ -399,27 +399,27 @@ public final class HelloResponse extends
}
// @@protoc_insertion_point(builder_scope:helloworld.HelloResponse)
// @@protoc_insertion_point(builder_scope:helloworld.HelloReply)
}
// @@protoc_insertion_point(class_scope:helloworld.HelloResponse)
private static final io.grpc.examples.helloworld.HelloResponse DEFAULT_INSTANCE;
// @@protoc_insertion_point(class_scope:helloworld.HelloReply)
private static final io.grpc.examples.helloworld.HelloReply DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.examples.helloworld.HelloResponse();
DEFAULT_INSTANCE = new io.grpc.examples.helloworld.HelloReply();
}
public static io.grpc.examples.helloworld.HelloResponse getDefaultInstance() {
public static io.grpc.examples.helloworld.HelloReply getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<HelloResponse>
PARSER = new com.google.protobuf.AbstractParser<HelloResponse>() {
public HelloResponse parsePartialFrom(
private static final com.google.protobuf.Parser<HelloReply>
PARSER = new com.google.protobuf.AbstractParser<HelloReply>() {
public HelloReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
try {
return new HelloResponse(input, extensionRegistry);
return new HelloReply(input, extensionRegistry);
} catch (RuntimeException e) {
if (e.getCause() instanceof
com.google.protobuf.InvalidProtocolBufferException) {
@ -431,16 +431,16 @@ public final class HelloResponse extends
}
};
public static com.google.protobuf.Parser<HelloResponse> parser() {
public static com.google.protobuf.Parser<HelloReply> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<HelloResponse> getParserForType() {
public com.google.protobuf.Parser<HelloReply> getParserForType() {
return PARSER;
}
public io.grpc.examples.helloworld.HelloResponse getDefaultInstanceForType() {
public io.grpc.examples.helloworld.HelloReply getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}

View File

@ -1,10 +1,10 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello_world.proto
// source: helloworld.proto
package io.grpc.examples.helloworld;
public interface HelloResponseOrBuilder extends
// @@protoc_insertion_point(interface_extends:helloworld.HelloResponse)
public interface HelloReplyOrBuilder extends
// @@protoc_insertion_point(interface_extends:helloworld.HelloReply)
com.google.protobuf.MessageOrBuilder {
/**

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello_world.proto
// source: helloworld.proto
package io.grpc.examples.helloworld;
@ -66,12 +66,12 @@ public final class HelloRequest extends
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.examples.helloworld.HelloRequest.class, io.grpc.examples.helloworld.HelloRequest.Builder.class);
}
@ -224,12 +224,12 @@ public final class HelloRequest extends
io.grpc.examples.helloworld.HelloRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_fieldAccessorTable
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.examples.helloworld.HelloRequest.class, io.grpc.examples.helloworld.HelloRequest.Builder.class);
}
@ -257,7 +257,7 @@ public final class HelloRequest extends
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.examples.helloworld.HelloWorldProto.internal_static_helloworld_HelloRequest_descriptor;
return io.grpc.examples.helloworld.HelloWorld.internal_static_helloworld_HelloRequest_descriptor;
}
public io.grpc.examples.helloworld.HelloRequest getDefaultInstanceForType() {

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello_world.proto
// source: helloworld.proto
package io.grpc.examples.helloworld;

View File

@ -1,10 +1,10 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello_world.proto
// source: helloworld.proto
package io.grpc.examples.helloworld;
public final class HelloWorldProto {
private HelloWorldProto() {}
public final class HelloWorld {
private HelloWorld() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
@ -14,10 +14,10 @@ public final class HelloWorldProto {
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_helloworld_HelloRequest_fieldAccessorTable;
static com.google.protobuf.Descriptors.Descriptor
internal_static_helloworld_HelloResponse_descriptor;
internal_static_helloworld_HelloReply_descriptor;
static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_helloworld_HelloResponse_fieldAccessorTable;
internal_static_helloworld_HelloReply_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
@ -27,12 +27,12 @@ public final class HelloWorldProto {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021hello_world.proto\022\nhelloworld\"\034\n\014Hello" +
"Request\022\014\n\004name\030\001 \001(\t\" \n\rHelloResponse\022\017" +
"\n\007message\030\001 \001(\t2L\n\007Greeter\022A\n\010SayHello\022\030" +
".helloworld.HelloRequest\032\031.helloworld.He" +
"lloResponse\"\000B0\n\033io.grpc.examples.hellow" +
"orldB\017HelloWorldProtoP\001b\006proto3"
"\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
"equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" +
"ssage\030\001 \001(\t2I\n\007Greeter\022>\n\010SayHello\022\030.hel" +
"loworld.HelloRequest\032\026.helloworld.HelloR" +
"eply\"\000B1\n\033io.grpc.examples.helloworldB\nH" +
"elloWorldP\001\242\002\003HLWb\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@ -52,11 +52,11 @@ public final class HelloWorldProto {
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_helloworld_HelloRequest_descriptor,
new java.lang.String[] { "Name", });
internal_static_helloworld_HelloResponse_descriptor =
internal_static_helloworld_HelloReply_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_helloworld_HelloResponse_fieldAccessorTable = new
internal_static_helloworld_HelloReply_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_helloworld_HelloResponse_descriptor,
internal_static_helloworld_HelloReply_descriptor,
new java.lang.String[] { "Message", });
}

View File

@ -41,8 +41,8 @@ import io.grpc.ManagedChannelBuilder;
import io.grpc.Metadata;
import io.grpc.Status;
import io.grpc.examples.helloworld.GreeterGrpc;
import io.grpc.examples.helloworld.HelloReply;
import io.grpc.examples.helloworld.HelloRequest;
import io.grpc.examples.helloworld.HelloResponse;
import io.grpc.internal.GrpcUtil;
import java.util.concurrent.CountDownLatch;
@ -75,12 +75,12 @@ public class CompressingHelloWorldClient {
/** Say hello to server. */
public void greet(final String name) {
final ClientCall<HelloRequest, HelloResponse> call =
final ClientCall<HelloRequest, HelloReply> call =
channel.newCall(GreeterGrpc.METHOD_SAY_HELLO, CallOptions.DEFAULT);
final CountDownLatch latch = new CountDownLatch(1);
call.start(new Listener<HelloResponse>() {
call.start(new Listener<HelloReply>() {
@Override
public void onHeaders(Metadata headers) {
super.onHeaders(headers);
@ -91,7 +91,7 @@ public class CompressingHelloWorldClient {
}
@Override
public void onMessage(HelloResponse message) {
public void onMessage(HelloReply message) {
super.onMessage(message);
logger.info("Greeting: " + message.getMessage());
latch.countDown();

View File

@ -38,8 +38,8 @@ import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;
import io.grpc.examples.helloworld.GreeterGrpc;
import io.grpc.examples.helloworld.HelloReply;
import io.grpc.examples.helloworld.HelloRequest;
import io.grpc.examples.helloworld.HelloResponse;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
@ -77,7 +77,7 @@ public class CustomHeaderClient {
private void greet(String name) {
logger.info("Will try to greet " + name + " ...");
HelloRequest request = HelloRequest.newBuilder().setName(name).build();
HelloResponse response;
HelloReply response;
try {
response = blockingStub.sayHello(request);
} catch (StatusRuntimeException e) {

View File

@ -35,8 +35,8 @@ import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.ServerInterceptors;
import io.grpc.examples.helloworld.GreeterGrpc;
import io.grpc.examples.helloworld.HelloReply;
import io.grpc.examples.helloworld.HelloRequest;
import io.grpc.examples.helloworld.HelloResponse;
import io.grpc.stub.StreamObserver;
import java.io.IOException;
@ -98,8 +98,8 @@ public class CustomHeaderServer {
private class GreeterImpl implements GreeterGrpc.Greeter {
@Override
public void sayHello(HelloRequest req, StreamObserver<HelloResponse> responseObserver) {
HelloResponse reply = HelloResponse.newBuilder().setMessage("Hello " + req.getName()).build();
public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
}

View File

@ -64,7 +64,7 @@ public class HelloWorldClient {
public void greet(String name) {
logger.info("Will try to greet " + name + " ...");
HelloRequest request = HelloRequest.newBuilder().setName(name).build();
HelloResponse response;
HelloReply response;
try {
response = blockingStub.sayHello(request);
} catch (StatusRuntimeException e) {

View File

@ -92,8 +92,8 @@ public class HelloWorldServer {
private class GreeterImpl implements GreeterGrpc.Greeter {
@Override
public void sayHello(HelloRequest req, StreamObserver<HelloResponse> responseObserver) {
HelloResponse reply = HelloResponse.newBuilder().setMessage("Hello " + req.getName()).build();
public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + req.getName()).build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
}

View File

@ -29,16 +29,17 @@
syntax = "proto3";
package helloworld;
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option java_outer_classname = "HelloWorld";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloResponse) {}
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
@ -47,6 +48,6 @@ message HelloRequest {
}
// The response message containing the greetings
message HelloResponse {
message HelloReply {
string message = 1;
}
}