Support Protobuf serialization in WebFlux
This commit introduces Protobuf support in WebFlux via dedicated codecs. Flux<Message> are serialized/deserialized using delimited Protobuf messages with the size of each message specified before the message itself. In that case, a "delimited=true" parameter is added to the content type. Mono<Message> are expected to use regular Protobuf message format (without the size prepended before the message). Related HttpMessageReader/Writer are automatically registered when the "com.google.protobuf:protobuf-java" library is detected in the classpath, and can be customized easily if needed via CodecConfigurer, for example to specify protocol extensions via the ExtensionRegistry based constructors. Both "application/x-protobuf" and "application/octet-stream" mime types are supported. Issue: SPR-15776
This commit is contained in:
committed by
Sebastien Deleuze
parent
4475c67ba8
commit
36a07aa897
12
spring-webflux/src/test/proto/sample.proto
Normal file
12
spring-webflux/src/test/proto/sample.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
option java_package = "org.springframework.web.reactive.protobuf";
|
||||
option java_outer_classname = "OuterSample";
|
||||
option java_multiple_files = true;
|
||||
|
||||
message Msg {
|
||||
optional string foo = 1;
|
||||
optional SecondMsg blah = 2;
|
||||
}
|
||||
|
||||
message SecondMsg {
|
||||
optional int32 blah = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user