dotnet / reactive

The Reactive Extensions for .NET
http://reactivex.io
MIT License
6.67k stars 747 forks source link

Project Reactor API - Flux and Mono (~spring webflux enabler for aspnet) #1844

Open jkone27 opened 1 year ago

jkone27 commented 1 year ago

Description

maybe could be interesting for Java/Spring webflux developers which desire to migrate to .NET/aspnet, to have an API in C#/F# similar to the one provided by project reactor and spring webflux, meaning Flux and Mono and potentially an integration with aspnetcore making it possible to define "reactive controllers" or reactive middleware endpoints and "reactive infrastructure" (http clients, db etc..)

https://www.infoq.com/articles/reactor-by-example/

https://www.baeldung.com/spring-webflux

maybe this could become useful ideally in some integration scenario with Giraffe or Aspnet in background, providing devs with a Java reactive-like experience?

Reactor types: Flux<T> and Mono<T>

Flux and Mono.

A Flux is the equivalent of an RxJava Observable, capable of emitting 0 or more items, and then optionally either completing or erroring.

A Mono on the other hand can emit at most once. It corresponds to both Single and Maybe types on the RxJava side. Thus an asynchronous task that just wants to signal completion can use a Mono.

So i guess a Mono in F# would be an Option where IObservable is a single one Cheers!

akarnokd commented 1 year ago

My experience with .NET side is that they are not interested in reactive backpressure as we do it in RxJava/Reactor. They opted for async enumerables and some other technologies (https://reaqtive.net/) instead.

There was a port of Project Reactor to C# that got recently shut down apparently: https://github.com/spring-attic/reactor-core-dotnet . In general, reactive streams is in bad shape on .NET because they never fixed the TCK bugs related to the unit test framework. (https://github.com/reactive-streams/reactive-streams-dotnet/issues/47). Otherwise, such an idea is pretty much DIY.