Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Provide gRPC support [SPR-16358] #20905
gRPC is becoming defacto standard for service to service communication, due to its ubiquitous nature & use of HTTP2
Currently we have
Plus, modern service mesh frameworks like https://envoyproxy.io works very nicely with gRPC.
Developers in spring world requires this high performance, type safe service-service integration (tho we have integration with hystrix, gRPC is much more performant & support wide variety of languages).
Here are some pain points in using grpc-java in spring world
If spring can scaffold a WebFlux/MVC project from grpc service definition, it will improve the development experience & at the sametime developers like me can enjoy the benefits of gRPC
7 votes, 18 watchers
Rossen Stoyanchev commented
Thanks for starting this discussion.
To me Spring MVC and WebFlux are web frameworks where the programming model is explicitly and intentionally based on HTTP. By contrast gRPC is a remote invocation, messaging framework where HTTP/2 is only a transport and does not impact the programming model. I see those as alternatives so I'm unsure what you're actually asking. For example if we scaffold a Spring MVC and WebFlux application, wouldn't that mean not using gRPC infrastructure at runtime (aside from
Thanks for your quick response.
To be honest, I have not done the complete deep dive into the spec & implementation details of gRPC.
My assumption was that it streams the requests & responses over HTTP2 within single connection, with both request & response body being encoded in protobuf, Which is what you explained :)
Since I am not that knowledgeable in the overall protocol, I looked up this document that details how they use frames within http to send & receive data over single connection.
Frankly I dint understand most of the document :)
Here is an interesting FAQ that found on their website
My assumption is that they are doing some preprocessing on the client/on the server (or) hardcoding urls within code generation itself for path parameters, not sure which
Since you might have better context on the internal implementation of Spring WebFlux, would appreciate if you can help us understand if
Thanks for point it out. I am already aware of the community maintained repo, but the repo is more of a work around.
The community maintained repo has all the problems I listed in the original problem statement.
These piecemeal solutions is what necessitated me opening this issue, so that we can start the discussion around identifying & probably finding a solution that's more well throughout
Rossen Stoyanchev commented
The Salesforce reactive-grpc project provides reactive library adapters including one for Reactor so you can use Flux and Mono and underneath they're adapted to gRPC with flow control. For more on why this matters, see the rational from the proposal to support Reactive Streams in grpc-core/C++ but thanks to Reactor and reactive-grpc, those benefits are already available for Java applications, and the resulting programming model is well aligned with the WebFlux programming model.
About gRPC and WebFlux:
So both run on the same server, but the have different runtime layers, and expose different programming models on top. We could change WebFlux to support the gRPC protocol, but that would replace the gRPC-Java runtime layer, and I suspect that's not what most gRPC users would expect or want.
I think between gRPC-Java, the reactive-grpc adapters, and the grpc-spring-boot-starter, there are enough pieces out there at the moment. I don't think validation alone is enough to justify dedicated support, and for security I recommend creating a ticket under Spring Security. I'll leave this ticket open in the backlog but I don't see much to do at this time.
In the mean time note that we're also exploring support for RSocket with #21292.
This was referenced
Jan 11, 2019
Disclosure: I'm one of the core maintainers of yidongnan/grpc-spring-boot-starter.