Add gRPC server and client samples with Spring Integration#377
Add gRPC server and client samples with Spring Integration#377cppwfs wants to merge 1 commit intospring-projects:mainfrom
Conversation
Implement gRPC examples demonstrating Spring Integration's gRPC support for both server and client scenarios. Server implementation: - Add `GrpcInboundGateway` with service routing for multiple RPC patterns - Implement unary RPC and server streaming streaming methods - Configure HelloWorldService with message routing based on service method headers Client implementation: - Add `GrpcOutboundGateway` for unary and streaming response handling - Implement ApplicationRunner beans to demonstrate both communication patterns
|
Looks promising. Thanks. |
artembilan
left a comment
There was a problem hiding this comment.
It also would be great to have tests for these new examples.
This way the samples project would serve a role of smoke tests for core project.
Thanks
| springBootVersion=4.1.0-SNAPSHOT | ||
| protobufVersion=4.29.4 | ||
| protobufPluginVersion=0.9.4 | ||
| grpcVersion=1.78.0 |
There was a problem hiding this comment.
That's not where we keep versions.
See ext block in the build.gradle.
And I guess we don't need protobufPluginVersion variable since it can simply go to the plugin definition itself.
|
|
||
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-integration' | ||
| implementation "org.springframework.integration:spring-integration-grpc:7.1.0-SNAPSHOT" |
There was a problem hiding this comment.
Why do we need explicit SI version here?
More over there is a dedicated variable in the ext block.
| api("io.grpc:grpc-stub:$grpcVersion") | ||
| implementation("io.grpc:grpc-protobuf:$grpcVersion") | ||
| implementation ("io.grpc:grpc-services:$grpcVersion") | ||
| implementation("com.google.protobuf:protobuf-java:$protobufVersion") |
There was a problem hiding this comment.
Are you sure we need these deps if we use org.springframework.grpc:spring-grpc-spring-boot-starter ?
| //Test | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
| testImplementation 'org.springframework.integration:spring-integration-test' | ||
| testRuntimeOnly 'org.junit.platform:junit-platform-launcher' |
There was a problem hiding this comment.
If we need this, then it probably should go to the common deps section for all the projects.
|
|
||
| //Test | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
| testImplementation 'org.springframework.integration:spring-integration-test' |
There was a problem hiding this comment.
I think this one has to be in the common deps section.
If that is not the case, we should consider to improve the project.
|
|
||
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-integration' | ||
| implementation "org.springframework.integration:spring-integration-grpc:7.1.0-SNAPSHOT" |
There was a problem hiding this comment.
If you fix the server sample, I guess same has to be done for the client one, too.
| @@ -0,0 +1 @@ | |||
| spring.grpc.server.port=9090 No newline at end of file | |||
There was a problem hiding this comment.
New line in the end of each file.
I believe there supposed to be an option in IntelliJ IDEA.
| MessageChannel grpcInputChannelStreamResponse, | ||
| FluxMessageChannel grpcStreamOutputChannel) { | ||
| //TODO: Need advice, there has to be a better way than what I have below (or is this a bug in the | ||
| // GrpcOutboundGateway? |
There was a problem hiding this comment.
OK. Let's debug it together to see what is going on!
Implement gRPC examples demonstrating Spring Integration's gRPC support for both server and client scenarios.
Server implementation:
GrpcInboundGatewaywith service routing for multiple RPC patternsClient implementation:
GrpcOutboundGatewayfor unary and streaming response handling