Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

AutoRest: Explore migration to Project Reactor for next major release #303

Closed JonathanGiles closed 3 years ago

JonathanGiles commented 5 years ago

Project Reactor is JDK 8 based and presents a number of convenience APIs to support JDK 8 developers (ability to move to streams, create optionals, etc). It is also built upon reactive streams and supports operator fusion, etc and has been benchmarked to be extremely fast. Additionally, it provides a reactor-netty project that can provide a backpressure-ready network engine.

It would be good to have this issue track the discussion around moving to use this for the next generation for AutoRest output. The alternative, RxJava 2.x, is also a viable option, but it lacks the improved JDK 8 support and is not as advanced as project reactor is.

anuchandy commented 5 years ago

"Rx Java <--> Reactor" conversion APIs https://projectreactor.io/docs/adapter/release/api/reactor/adapter/rxjava/RxJava2Adapter.html

anuchandy commented 5 years ago

Benchmark comparision between rx-java2 and reactor https://github.com/akarnokd/akarnokd-misc/issues/7. This is from dev leading rx-java effort @akarnokd.

He tweeted - use Reactor if you are in Java 8+ and use rx-java-2 if you are stuck with <= java 6, 7 https://twitter.com/akarnokd/status/774590596740685824?lang=en and mentioned both can be improved.

Reactor shines in Java 8 as it has better integration with Java 8 constructs.

akarnokd commented 5 years ago

not as advanced as project reactor

They have the same underlying architecture but have to consider different platform limitations. One feature missing from RxJava is the context support. If Android is not a target for this project, you can safely go with Reactor.

JonathanGiles commented 5 years ago

My position is to prefer Reactor due to its JDK 8 API friendliness, but Android is a consideration that needs to be kept in mind. Unofficially Reactor supports API level 26, but that is a very high level that may not be achievable as a baseline.

lmazuel commented 5 years ago

Assign this explicitly to @anuchandy who as a lot of thinking already on this

jianghaolu commented 3 years ago

v4 is based on project reactor now.