Add gRPC server sample with Spring Integration#382
Add gRPC server sample with Spring Integration#382artembilan merged 3 commits intospring-projects:mainfrom
Conversation
Introduce a new basic sample demonstrating the GrpcInboundGateway. This provides users with a reference implementation for handling both unary and server streaming gRPC requests using Spring Boot. - Add grpc-server module with protobuf definitions - Configure GrpcInboundGateway to route by service method - Include tests demonstrating in-process gRPC communication
artembilan
left a comment
There was a problem hiding this comment.
Pretty cool!
I don't have too many concerns on what you have done so far.
Thank you!
...pc-server/src/main/java/org/springframework/integration/samples/grpc/server/Application.java
Outdated
Show resolved
Hide resolved
...erver/src/test/java/org/springframework/integration/samples/grpc/server/GrpcServerTests.java
Outdated
Show resolved
Hide resolved
...erver/src/test/java/org/springframework/integration/samples/grpc/server/GrpcServerTests.java
Outdated
Show resolved
Hide resolved
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-integration' | ||
| implementation 'org.springframework.boot:spring-boot-starter-grpc-server' | ||
| implementation 'org.springframework.integration:spring-integration-grpc' |
There was a problem hiding this comment.
Not related to your work here, but nice to have eventually.
I believe there is a feature on start.spring.io when you chose Spring Integration and some other protocol-specific, e.g. JMS Starter, Spring for Apache Kafka, RabbitMQ starter etc., then respective Spring Integration module is added to dependencies.
For example:

And this is a set of dependencies generated from there:
dependencies {
implementation("org.springframework.boot:spring-boot-starter-integration")
implementation("org.springframework.boot:spring-boot-starter-webservices")
implementation("org.springframework.integration:spring-integration-ws")
testImplementation("org.springframework.boot:spring-boot-starter-webservices-test")
testImplementation("org.springframework.integration:spring-integration-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
So, I think we should raise an improvement request to the https://github.com/spring-io/initializr to include spring-integration-grpc when this or that gRPC starter is chosen together with Spring Integration.
- Remove unused properties from application.properties and test - Simplify exclusion for netty in tests - Update javadoc for Applicaition.java to be 3rd person narrative
| import org.springframework.messaging.Message; | ||
|
|
||
| /** | ||
| * Configure {@link org.springframework.integration.grpc.inbound.GrpcInboundGateway}. |
There was a problem hiding this comment.
Right.
And why this class Javadoc is still imperative?
Looks like we don't need that FQCN for the GrpcInboundGateway: we have it imported and we use it in the following code.
build.gradle
Outdated
| configurations { | ||
| testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty' | ||
| testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test') { | ||
| exclude group: 'io.grpc', module: 'grpc-netty' |
There was a problem hiding this comment.
This is cool!
Do we have any story on Spring Boot side to avoid this but control the test behavior via properties?
Or maybe some dedicated to in-process dependency...
- All class javadocs should be 3rd person narrative vs imperative - Add TODO to check exclude for grpc tests
Introduce a new basic sample demonstrating the GrpcInboundGateway. This provides users with a reference implementation for handling both unary and server streaming gRPC requests using Spring Boot.