Add gRPC client sample with Spring Integration#379
Add gRPC client sample with Spring Integration#379artembilan merged 7 commits intospring-projects:mainfrom
Conversation
artembilan
left a comment
There was a problem hiding this comment.
Very cool!
Straight and clean.
Just couple nit-picks and questions.
Thanks
basic/grpc-client/src/main/java/org/springframework/integration/samples/Application.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/integration/samples/grpc/client/GrpcClientConfiguration.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/integration/samples/grpc/client/GrpcClientConfiguration.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/springframework/integration/samples/grpc/client/GrpcClientConfiguration.java
Outdated
Show resolved
Hide resolved
| */ | ||
| @SpringBootTest(properties = { | ||
| "spring.grpc.server.inprocess.name=test", | ||
| "spring.grpc.client.channels.local.address=in-process:test" |
There was a problem hiding this comment.
I think this is going to fail now, since the name of the channel is not local any more.
If it doesn't then something is off somewhere.
|
Please, rebase to the latest |
Implement a new basic sample demonstrating Spring Integration's gRPC client capabilities. This sample shows how to integrate gRPC with Spring Boot and Spring Integration for both single-response and streaming response patterns. This example is based on the proto file that exists in the Spring gRPC project, to provide user familiarity
Signed-off-by: Glenn Renfro <glenn.renfro@broadcom.com>
- Config uses GrpcHeaders.SERVICE_METHOD for method def - Removed amqp dependency update - Removed changes to barrier pom.xml - spring grpc now uses bom
- One flow now sets method at flow definition time - Tests updated to not use port 9090 - Tests disable netty server as it is not needed (and opens port unnecessarily) - Readme updated - Add pom.xml - Rebased
e719956 to
685bcb0
Compare
| */ | ||
| @Bean | ||
| @Primary | ||
| NettyGrpcServerFactory nettyGrpcServerFactory() { |
There was a problem hiding this comment.
M-m-m.
Isn't this conditional on some class?
Maybe we can just don't use that dependency for the server side?
I mean if this raises the question with me, the end-user who tries to learn from us would be confused, too.
We are demonstrating a client in this sample.
Yes, we provide a server in the test, but that is inprocess. Very strange to end up with Netty server here.
If that is not something we can mitigating through existing Spring gRPC feature, might worth raising this concern with that project.
exclude netty dependencies from test
build.gradle
Outdated
| testImplementation "org.springframework.grpc:spring-grpc-test" | ||
|
|
||
| configurations { | ||
| testImplementation.exclude group: 'io.grpc', module: 'grpc-netty' |
There was a problem hiding this comment.
I think testRumtimeOnly should be enough.
I guess we need it for the client part to connect anyway at runtime .
Or just come back to named channel in test props !
it was unecessary
| testImplementation "org.springframework.grpc:spring-grpc-test" | ||
|
|
||
| configurations { | ||
| testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty' |
There was a problem hiding this comment.
So, this means that spring.grpc.test.inprocess.exclusive=true is not that exclusive in reality since there is still auto-configured respective channel factory which confuses our sample configuration when we run the test.
Just a question seeking the truth behind change which feels unnecessary.
Thanks
artembilan
left a comment
There was a problem hiding this comment.
OK. Since there is no way to avoid that exclusion.
I'm merging this.
We can revise later when Spring gRPC has done anything on the matter.
Thanks
Implement a new basic sample demonstrating Spring Integration's gRPC client capabilities. This sample shows how to integrate gRPC with Spring Boot and Spring Integration for both single-response and streaming response patterns.
This example is based on the proto file that exists in the Spring gRPC project, to provide user familiarity