This video is a gentle introduction to Reactive Programming. Using a number of real-life examples that show why it is a good idea and how it can make your life easier (and your code better).
I have been looking for a reactivex implementation in Elixir, and I found https://github.com/alfert/reaxive but it is not very active. That would be nice to have an Elixir implementation.
Now that being said ReactiveX programming is about scaffolding observables (objects) in order to propagate and route events to drive your program flow. While this may seem revolutionary in largely imperative, single or heavy weight thread environments, messages (events) are the bread and butter of Erlang/Elixir, so none of this is particularly exciting.
If you have multiple “observables” in a single (sequential) BEAM process then it probably has logic that should be distributed over multiple processes. Meanwhile a single BEAM process serving as a single “observable” often doesn’t have enough responsibility. So I don’t think Rx makes much sense in Erlang/Elixir.
To me it seems that the GenStage approach is a more “macro” way of approaching similar problems.
See also this discussion: Is Phoenix ‘Reactive’ like the Play framework?
Edit: To put things into perspective I look at it this way:
- Enum.map/2 is eager. It processes everything that is available but also only starts processing once all data is available.
- Stream.map/2 is lazy. It only processes what is demanded even if more data is available.
- ReactiveX map is reactive. It processes data as it becomes available (provided it gets some work cycles). If that doesn’t sound like a BEAM process processing messages from its mailbox one after another …
So for me “reactive” evaluation sits right between “eager” and “lazy”.