Skip to content

Add gRPC client sample with Spring Integration#379

Merged
artembilan merged 7 commits intospring-projects:mainfrom
cppwfs:grpc-client-sample
Mar 20, 2026
Merged

Add gRPC client sample with Spring Integration#379
artembilan merged 7 commits intospring-projects:mainfrom
cppwfs:grpc-client-sample

Conversation

@cppwfs
Copy link
Contributor

@cppwfs cppwfs commented Mar 18, 2026

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

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!
Straight and clean.

Just couple nit-picks and questions.

Thanks

*/
@SpringBootTest(properties = {
"spring.grpc.server.inprocess.name=test",
"spring.grpc.client.channels.local.address=in-process:test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@artembilan
Copy link
Member

Please, rebase to the latest main

cppwfs added 5 commits March 19, 2026 11:31
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
@cppwfs cppwfs force-pushed the grpc-client-sample branch from e719956 to 685bcb0 Compare March 19, 2026 18:56
*/
@Bean
@Primary
NettyGrpcServerFactory nettyGrpcServerFactory() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !

testImplementation "org.springframework.grpc:spring-grpc-test"

configurations {
testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@artembilan artembilan merged commit 1350e9e into spring-projects:main Mar 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants