RxJava composes asynchronous and event-driven flows with observable sequences on the Java virtual machine. It extends the observer pattern with declarative operators and schedulers.
Overview
RxJava implements Reactive Extensions for JVM languages so programs can express pipelines of asynchronous data and events. Operators chain together sources, transformations, and consumers while abstracting threading, synchronization, and concurrent structures.
Core types include Flowable for backpressured streams, Observable for shorter or UI-bound sequences, and Single, Maybe, and Completable for zero-or-one outcomes. Schedulers route work across computation, I/O, single-thread, and virtual-thread pools, with platform-specific main-thread schedulers noted for Android, Swing, and JavaFX.
Version 4 emphasizes java.util.concurrent.Flow integration, virtual thread helpers, and a Streamable type for blocking-style handoffs. Documentation walks through assembly, subscription, and runtime phases, plus patterns for background work and UI updates.
Key features
- Observable and Flowable streams
- Composable operator chains
- Backpressure-aware Flowable type
- Scheduler abstraction for threads
- Virtual thread scheduler support
- Single, Maybe, Completable types
- Parallel and flatMap processing
- java.util.concurrent.Flow alignment
Use cases
- Asynchronous service pipelines
- Event-driven UI updates
- Network call composition
- Coordinating background computation