Skip to content

Commit 3a53b7d

Browse files
authored
Merge pull request #17 from ExpediaInc/master
Update to GRPC 0.15.0 and Spring Boot 1.3.6 Thanks,Jonathan
2 parents 74fbbc5 + f1b5c8d commit 3a53b7d

File tree

9 files changed

+243
-140
lines changed

9 files changed

+243
-140
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.gradle
2+
build/
3+
gradle-app.setting
4+
!gradle-wrapper.jar
5+
.gradletasknamecache
6+
.idea
7+
*.iml

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'idea'
22
buildscript {
33
ext {
4-
springBootVersion = '1.3.2.RELEASE'
4+
springBootVersion = '1.3.6.RELEASE'
55
}
66
repositories {
77
mavenCentral()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat Jun 11 11:03:38 CEST 2016
1+
#Sat Jul 23 13:11:27 PDT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip

grpc-spring-boot-starter-demo/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ apply plugin: 'com.google.protobuf'
22
apply plugin: 'spring-boot'
33

44
dependencies {
5-
compile 'io.grpc:grpc-stub:0.12.0'
6-
compile 'io.grpc:grpc-protobuf:0.12.0'
7-
compile 'io.grpc:grpc-netty:0.12.0'
5+
compile 'io.grpc:grpc-stub:0.15.0'
6+
compile 'io.grpc:grpc-protobuf:0.15.0'
7+
compile 'io.grpc:grpc-netty:0.15.0'
88
compile("org.springframework.boot:spring-boot-starter-actuator")
99
compile('org.springframework.boot:spring-boot-starter-web')
1010
compile project(':grpc-spring-boot-starter')
@@ -21,11 +21,11 @@ sourceSets {
2121

2222
protobuf {
2323
protoc {
24-
artifact = 'com.google.protobuf:protoc:3.0.0-alpha-3'
24+
artifact = 'com.google.protobuf:protoc:3.0.0-beta-3'
2525
}
2626
plugins {
2727
grpc {
28-
artifact = 'io.grpc:protoc-gen-grpc-java:0.12.0'
28+
artifact = 'io.grpc:protoc-gen-grpc-java:0.15.0'
2929
}
3030
}
3131

@@ -55,7 +55,7 @@ clean.dependsOn cleanProtoGen
5555

5656
dependencyManagement {
5757
imports {
58-
mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Brixton.M4'
58+
mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Brixton.SR3'
5959
}
6060
}
6161

grpc-spring-boot-starter-demo/src/main/protoGen/io/grpc/examples/GreeterGrpc.java

Lines changed: 123 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,25 @@
1212
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
1313
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
1414
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
15+
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
16+
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
1517

16-
@javax.annotation.Generated("by gRPC proto compiler")
18+
/**
19+
* <pre>
20+
* The greeter service definition.
21+
* </pre>
22+
*/
23+
@javax.annotation.Generated(
24+
value = "by gRPC proto compiler (version 0.15.0)",
25+
comments = "Source: greeter.proto")
1726
public class GreeterGrpc {
1827

1928
private GreeterGrpc() {}
2029

2130
public static final String SERVICE_NAME = "Greeter";
2231

2332
// Static method descriptors that strictly reflect the proto.
24-
@io.grpc.ExperimentalApi
33+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
2534
public static final io.grpc.MethodDescriptor<io.grpc.examples.GreeterOuterClass.HelloRequest,
2635
io.grpc.examples.GreeterOuterClass.HelloReply> METHOD_SAY_HELLO =
2736
io.grpc.MethodDescriptor.create(
@@ -31,33 +40,86 @@ private GreeterGrpc() {}
3140
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.examples.GreeterOuterClass.HelloRequest.getDefaultInstance()),
3241
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.examples.GreeterOuterClass.HelloReply.getDefaultInstance()));
3342

43+
/**
44+
* Creates a new async stub that supports all call types for the service
45+
*/
3446
public static GreeterStub newStub(io.grpc.Channel channel) {
3547
return new GreeterStub(channel);
3648
}
3749

50+
/**
51+
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
52+
*/
3853
public static GreeterBlockingStub newBlockingStub(
3954
io.grpc.Channel channel) {
4055
return new GreeterBlockingStub(channel);
4156
}
4257

58+
/**
59+
* Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
60+
*/
4361
public static GreeterFutureStub newFutureStub(
4462
io.grpc.Channel channel) {
4563
return new GreeterFutureStub(channel);
4664
}
4765

48-
public static interface Greeter {
66+
/**
67+
* <pre>
68+
* The greeter service definition.
69+
* </pre>
70+
*/
71+
@java.lang.Deprecated public static interface Greeter {
4972

73+
/**
74+
* <pre>
75+
* Sends a greeting
76+
* </pre>
77+
*/
5078
public void sayHello(io.grpc.examples.GreeterOuterClass.HelloRequest request,
5179
io.grpc.stub.StreamObserver<io.grpc.examples.GreeterOuterClass.HelloReply> responseObserver);
5280
}
5381

54-
public static interface GreeterBlockingClient {
82+
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
83+
public static abstract class GreeterImplBase implements Greeter, io.grpc.BindableService {
5584

85+
@java.lang.Override
86+
public void sayHello(io.grpc.examples.GreeterOuterClass.HelloRequest request,
87+
io.grpc.stub.StreamObserver<io.grpc.examples.GreeterOuterClass.HelloReply> responseObserver) {
88+
asyncUnimplementedUnaryCall(METHOD_SAY_HELLO, responseObserver);
89+
}
90+
91+
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
92+
return GreeterGrpc.bindService(this);
93+
}
94+
}
95+
96+
/**
97+
* <pre>
98+
* The greeter service definition.
99+
* </pre>
100+
*/
101+
@java.lang.Deprecated public static interface GreeterBlockingClient {
102+
103+
/**
104+
* <pre>
105+
* Sends a greeting
106+
* </pre>
107+
*/
56108
public io.grpc.examples.GreeterOuterClass.HelloReply sayHello(io.grpc.examples.GreeterOuterClass.HelloRequest request);
57109
}
58110

59-
public static interface GreeterFutureClient {
111+
/**
112+
* <pre>
113+
* The greeter service definition.
114+
* </pre>
115+
*/
116+
@java.lang.Deprecated public static interface GreeterFutureClient {
60117

118+
/**
119+
* <pre>
120+
* Sends a greeting
121+
* </pre>
122+
*/
61123
public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.GreeterOuterClass.HelloReply> sayHello(
62124
io.grpc.examples.GreeterOuterClass.HelloRequest request);
63125
}
@@ -107,7 +169,7 @@ protected GreeterBlockingStub build(io.grpc.Channel channel,
107169
@java.lang.Override
108170
public io.grpc.examples.GreeterOuterClass.HelloReply sayHello(io.grpc.examples.GreeterOuterClass.HelloRequest request) {
109171
return blockingUnaryCall(
110-
getChannel().newCall(METHOD_SAY_HELLO, getCallOptions()), request);
172+
getChannel(), METHOD_SAY_HELLO, getCallOptions(), request);
111173
}
112174
}
113175

@@ -136,21 +198,62 @@ public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.Greet
136198
}
137199
}
138200

139-
public static io.grpc.ServerServiceDefinition bindService(
201+
@java.lang.Deprecated public static abstract class AbstractGreeter extends GreeterImplBase {}
202+
203+
private static final int METHODID_SAY_HELLO = 0;
204+
205+
private static class MethodHandlers<Req, Resp> implements
206+
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
207+
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
208+
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
209+
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
210+
private final Greeter serviceImpl;
211+
private final int methodId;
212+
213+
public MethodHandlers(Greeter serviceImpl, int methodId) {
214+
this.serviceImpl = serviceImpl;
215+
this.methodId = methodId;
216+
}
217+
218+
@java.lang.Override
219+
@java.lang.SuppressWarnings("unchecked")
220+
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
221+
switch (methodId) {
222+
case METHODID_SAY_HELLO:
223+
serviceImpl.sayHello((io.grpc.examples.GreeterOuterClass.HelloRequest) request,
224+
(io.grpc.stub.StreamObserver<io.grpc.examples.GreeterOuterClass.HelloReply>) responseObserver);
225+
break;
226+
default:
227+
throw new AssertionError();
228+
}
229+
}
230+
231+
@java.lang.Override
232+
@java.lang.SuppressWarnings("unchecked")
233+
public io.grpc.stub.StreamObserver<Req> invoke(
234+
io.grpc.stub.StreamObserver<Resp> responseObserver) {
235+
switch (methodId) {
236+
default:
237+
throw new AssertionError();
238+
}
239+
}
240+
}
241+
242+
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
243+
return new io.grpc.ServiceDescriptor(SERVICE_NAME,
244+
METHOD_SAY_HELLO);
245+
}
246+
247+
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
140248
final Greeter serviceImpl) {
141-
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
142-
.addMethod(
143-
METHOD_SAY_HELLO,
144-
asyncUnaryCall(
145-
new io.grpc.stub.ServerCalls.UnaryMethod<
249+
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
250+
.addMethod(
251+
METHOD_SAY_HELLO,
252+
asyncUnaryCall(
253+
new MethodHandlers<
146254
io.grpc.examples.GreeterOuterClass.HelloRequest,
147-
io.grpc.examples.GreeterOuterClass.HelloReply>() {
148-
@java.lang.Override
149-
public void invoke(
150-
io.grpc.examples.GreeterOuterClass.HelloRequest request,
151-
io.grpc.stub.StreamObserver<io.grpc.examples.GreeterOuterClass.HelloReply> responseObserver) {
152-
serviceImpl.sayHello(request, responseObserver);
153-
}
154-
})).build();
255+
io.grpc.examples.GreeterOuterClass.HelloReply>(
256+
serviceImpl, METHODID_SAY_HELLO)))
257+
.build();
155258
}
156259
}

0 commit comments

Comments
 (0)