Hello, dear community. I'd like to use flatbuffer with spring boot and webflux. How I can use it with spring?
I've tried to do this points:
- Created own AbstractHttpMessageConverter
class FlatBufferMessageConvertor : AbstractHttpMessageConverter<Table>(X_FLATBUFFERS)
- Added as Bean
@Bean fun flatBufferMessageConvertor(): HttpMessageConverter<Table> = flatBufferMessageConvertor
- Controller has:
@PostMapping(value = ["/package"]) fun receive(@RequestBody request: Request): Mono<Response> = packageService.handle(request)
But I still have exception:
415 UNSUPPORTED_MEDIA_TYPE "Content type 'application/x-flatbuffer' not supported for bodyType=Request"
Perhaps there's some common case in spring boot (like with Protocol Buffer).
I look forward to any answer or idea how this can be done. Thanks!
Current versions:
id("org.springframework.boot") version "2.4.5"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.4.31"
kotlin("plugin.spring") version "1.4.31"
dependencies:
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation(group= "com.google.flatbuffers", name= "flatbuffers-java", version = "2.0.0")
Comment From: wilkinsona
HttpMessageConverter
s are used by Spring MVC. If you're interested in WebFlux support, you'd need to implement a org.springframework.core.codec.Decoder
for use by a DecoderHttpMessageReader
and a org.springframework.core.codec.Encoder
for use by an EncoderHttpMessageReader
as Spring Framework already does for Protocol Buffers.
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.
/cc @rstoyanchev on the Spring Framework team for awareness as, judging by the Framework issue tracker, this is the first time that FlatBuffers support has been requested.
Comment From: eeUtpTester
Thanks a lot!