spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.36k stars 38.03k forks source link

Introduce Vert.x as a reactive runtime [SPR-14955] #19522

Closed spring-projects-issues closed 7 years ago

spring-projects-issues commented 7 years ago

Yevhenii Melnyk opened SPR-14955 and commented

Vert.x as well as Reactor and RxNetty provides powerful support for creating non-blocking event-driven web applications and supports WebSockets and Http2. Are there any plans on implementing new adapters for reactive spring?


Affects: 5.x Backlog

Reference URL: https://github.com/spring-projects/spring-framework/pull/1247

1 votes, 5 watchers

spring-projects-issues commented 7 years ago

Yevhenii Melnyk commented

I've tried to implement simple Vert.x support. For now there is implementation of HttpHandlerAdapterSupport. Here's the pull request

spring-projects-issues commented 7 years ago

Brian Clozel commented

Hi Yevhenii Melnyk,

Could you elaborate on the goal of this PR? Spring Web Reactive already integrates with Netty two times (Reactor-Netty and RxNetty), Undertow, Servlet 3.1+ (Jetty, Tomcat, etc). Those are all runtimes / runtime adapters.

From my point of view, Vert.x is much more than that and adapting it to the Spring programming model is missing the goal of that toolkit.

Could you explain how you would leverage the Vert.x programming model and features in that context? Could you elaborate on concrete uses cases for this integration?

Thanks!

spring-projects-issues commented 7 years ago

Yevhenii Melnyk commented

Hello Brian,

I was curious of how Spring Web Reactive is built inside and tryed to implement it myself. Unfortunately I don't have real life use cases.

I knew that Vert.x has much more tools except http server, I just thought that my implementation could be useful. Sorry for distracting, I'll close the request.

Thank you for attention!

spring-projects-issues commented 7 years ago

Brian Clozel commented

Hey Yevhenii Melnyk, I didn't mean to shut this off really, we can still discuss this feature. We're always happy to receive PRs and get interesting proposals on our jira. Feel free to open new issues here or drop some comments on existing ones - we can always guide you if you'd like to contribute to the project (before spending a significant amount of time on a specific issue).

Thanks!

spring-projects-issues commented 7 years ago

Rossen Stoyanchev commented

Resolving for now.

spring-projects-issues commented 7 years ago

Julien Viet commented

The Eclipse Vert.x project is interested to see such integration contributed to Spring.

A part of Vert.x community are Spring users (or it can be seen the other way around :-) ) and it would definitely be something they would like to see happening.

The Vert.x commiters team would be glad to maintain this part in the Open Source spirit.

spring-projects-issues commented 7 years ago

Rossen Stoyanchev commented

hi Julien Viet thanks for the interest and offer to help.

As Brian mentioned the proposed PR, which to Yevhenii's point was merely an experiment, plugs Vert.x as a runtime at our lowest level of server abstraction. That implies the use of Spring for handling requests even if Vert.x can be plugged in for other higher-level services. Since Vert.x is much more than a runtime we need to get better insight into what an actual integration should look like. As you yourself alluded to, it's reasonable to even wonder whether it is a Vert.x integration with Spring, the other way around, or both? Real use cases and hearing from Spring users in the Vert.x community would be great.

Note that the PR in its present form does not extend the benefits of back-pressure -- a key concept in Reactive Streams and central to the architecture we're promoting -- into the Vert.x runtime. It bridges on read side. On the writing side I suspect it might block eventually when Netty is not able to write but I don't know enough about Vert.x. We also have a reactive WebClient as well as a WebSocket server and client abstractions where Vert.x would be expected to appear if we followed this route. Last but not least having a new runtime supported in the Spring Framework would require equivalent support in Spring Boot.

It's most clearly too late for the 5.0 timeframe. We are on a tight schedule from here on trying to wrap things up but we remain open to figure out what makes sense to do.

spring-projects-issues commented 7 years ago

Julien Viet commented

hi Rossen,

I made this enquiry because I extended Yevhenii contribution with this one https://github.com/vietj/spring-boot-web-reactive that extends Spring Boot Web Reactive to support Vert.x as a starter. For example for possible (and probably common) use case is combining Spring (Boot) Web Reactive with Vert.x microservices. As you Brian and you said, without such use cases there is little interest in these contributions.

Like you, we are not keen on rushing things and we are willing discussing with the you and the Spring team. I attended your Spring Reactive session at Devoxx and you said something important that it's all about having a Reactive ecosystem. So I rather see that as a way to create synergies between projects and extend the reactive ecosystem.

Let me know the best place to continue further discussions.