Please find bellow a summary of current status.
We did not find the time Silvano Riz and me to work on a reactive multipart implementation, so currently we use NIO Multipart API which is event-based BUT use blocking IO (InputStream / OutputStream), see this related discussion. It would be nice to review current bridge between NIO Multipart and Spring Web Reactive to have a better idea of the limitation of the current implementation.
Based on my discussion with Stéphane Maldini and this RxNetty discussion:
- Current Netty support for multipart can't be plugged easily in RxNetty or Reactor Netty architecture
- For long term, it would be nice to work with Norman on a way to get Multipart support from Netty that could be plugged in RxNetty and Reactor Netty
- Current Multipart support on Reactor Netty is mainly client side oriented
- Even if we add a Flux<ByteBufFlux> MultipartInbound#from(HttpServerRequest inbound) variant, that would only allow us to get the content of the file (no headers, not filename, no encoding support, etc.) so there would non-trivial improvements to support what we need to expose in Spring multipart API.
My current proposal for 5.0 would be:
- Review NIO Multipart to Spring Web Reactive bridge with the team (including Simon and Stéphane) to identify the impact of the part of the API that is blocking
- Identify if we should use specific schedulers to run NIO Multipart in order to not block too much Netty threads
- Decide if we should expose both Mono<MultiValueMap<String, Part>> getFormParts() and Flux<Part> getFormPartsAsFlux(), only the Mono based variant (I tend to think we should provide some kind of multipart support in 5.0 even if it comes with some limitation clearly documented)
- Keep this issue/PR scope as it is (already quite big) and create 2 distinct issues to provide integration in both annotation and functional API
For 5.1 target, 2 roads could be explored:
- Try to see if we can move forward on first-class multipart reactive support on RxNetty and Reactor Netty (possibly by refactoring Netty Multipart support, to be discussed with Norman)
- Collaborate with Silvano Riz on a reactive multipart implementation that could be used independently of the engine used