/rx

ReactiveX for Elixir

Primary LanguageElixirApache License 2.0Apache-2.0

Build Status Hex.pm Ebert Coverage Status

RxElixir: ReactiveX for Elixir

VERY PRELIMINARY: I'm making this repo public for now so I can use some of the free and open source tools, but it is far from a meaningful public release.

RxElixir (or simply Rx) allows developers to express computations on asynchronous event streams. It offers several common pre-built patterns that allow you to respond to, combine, filter, and transform events.

It implements the ReactiveX Observer pattern in a way that makes sense in the Elixir/OTP environment.

RxElixir is thought to be most useful in responding to user-generated data events and similar arbitrarily asynchronous data streams. The tradeoffs made here favor:

  • memory efficiency (for example, using as few OTP processes as possible)
  • combining and transforming multiple independent asynchronous event streams
  • performing time-based filtering of event streams
  • rapidly spawning and canceling tasks based on events over time

Though it follows some similar implementation patterns to the existing Flow library, it is different in some important ways:

  • RxElixir is not well suited for processing large volumes of data, especially where parallel processing is advantageous. (The example used to introduce Flow, counting word frequency in a multi-gigabyte file, is far better suited to Flow than RxElixir.)