Support Protobuf serialization in WebFlux [SPR-15776]
See original GitHub issueGreg Laubenstein opened SPR-15776 and commented
Currently there is no built in means to serialize and deserialize data objects with RPC/protobuf with reactive-web/webflux.
Affects: 5.0.4
Issue Links:
- #20513 Add CBOR support to WebFlux
- #20905 Provide gRPC support
- #10477 Spring REST
@MVC
: Add support for google Protocol Buffers resource representation format - #19985 Add Jackson Smile support to WebFlux
- #21962 ProtobufDecoder assumes number of bytes in delimited format will not be split into chunks
- #21283 Invalid mime type application/stream+json
- #21618 Deprecate ExtensionRegistryInitializer in protobuf support
Referenced from: commits https://github.com/spring-projects/spring-framework/commit/3899b7a909b15f521f99b2d267cb74264ac9682e, https://github.com/spring-projects/spring-framework/commit/36bbbab02da4d5c4500523f23a5ce28fa6a87dfb, https://github.com/spring-projects/spring-framework/commit/36a07aa89747bb5942bd4a1bf7f5192a2c48c5ef, https://github.com/spring-projects/spring-framework/commit/6b6384a09ed643252e46551d2cf58dbf5b485c88
4 votes, 13 watchers
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
Spring WebFlux With Protobuf - Vinsguru
In this tutorial, I would like to show you how we could use Spring WebFlux with Protobuf (Protocol Buffers) for your RESTful Microservices....
Read more >Spring WebFlux With Protobuf - Vinoth Selvaraj
Protocol Buffers, in short Protobuf, are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
Read more >Set Jvm Option For Avoid Error Illegal Reflective Access By ...
defineClass it's the supported way to inject classes into the same runtime ... Support Protobuf serialization in WebFlux [SPR15776] #20331.
Read more >spring-projects/spring-boot - Gitter
I have an application using webflux and reactor-netty. I would like to return a protobuf object from a rest api. I created a...
Read more >Spring webflux Netty: How to expose proto as json endpoints ...
I was messing around with this and ended up with this. Nothing else worked for me. Using protov3 and setting a protobuf like...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Rossen Stoyanchev commented
Indeed the gRPC Marshaller uses
InputStream
andOutputStream
. Of course those represent gRPC frames, so the input or output stream is naturally broken up into discrete messages. To achieve a similar effect, I found some relevant information on streaming and large data sets on the official Protobuf site:Then I looked for some media types to indicate protobuf streming with the length-delimited format, and found a couple examples:
There doesn’t seem to be a standard but we can look around some more and pick something. After all supported media types are easy to customize.
For the implementation, some useful notes here led me to MessageLite#mergeFrom which checks the size and returns true or false depending on whether it has read the full message or not. We probably still have to do extra work to buffer data chunks until a full message is parsed, but that hopefully not too bad.
Using “protobuf” and “delimited” as keywords, there may be more insight or examples out there for all of the above, but it seems we have enough here to give it a try.
Sébastien Deleuze commented
An improved version of Protobuf support will be available in Spring Framework 5.1 RC2, see this commit for more detail.