Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Project Reactor is a non-blocking reactive programming foundation for JVM applications and the reactive foundation used by Spring WebFlux. Its two core types, Flux and Mono, describe asynchronous work that can be composed and controlled through demand signals. A pipeline is usually lazy: operators describe the work, and subscription starts it.

What is Project Reactor?

Project Reactor is a reactive programming library for Java and the JVM. The official guide describes it as a fully non-blocking foundation with demand management, or backpressure; the project page characterizes it as a fourth-generation reactive foundation for Java 8 and above. It is based on the Reactive Streams specification, which defines a way for asynchronous components to exchange data while coordinating demand. Reactor 3 Reference Guide · Project Reactor

In practical terms, Reactor lets an application represent asynchronous results as publishers, transform and combine those publishers with operators, and manage how work is scheduled and how much data is requested. It is not itself a web framework; Spring WebFlux is one framework that uses Reactor types.

When should you use Flux or Mono?

The choice expresses how many values an operation can produce. Both types represent asynchronous outcomes and can complete or fail; the key distinction is their cardinality.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Type Possible values Typical use
Mono<T> Zero or one value, followed by completion, or an error A lookup that may find one record, a save operation returning one result, or an asynchronous result that may be empty
Flux<T> Zero to many values, optionally followed by completion, or an error A collection-like result, a sequence of events, or a stream whose values arrive over time

For example, a service method that retrieves one customer can naturally return Mono<Customer>; a method that streams matching customers can return Flux<Customer>. A Flux can emit no values, just as a Mono can be empty. Neither type guarantees that a value will arrive: an error is also a possible terminal outcome. Reactor 3 Reference Guide

When does a Reactor pipeline execute?

Creating a chain of operators normally assembles a description of work; it does not, by itself, make values flow. Execution begins when a subscriber subscribes. Subscription establishes the chain and sends demand upstream. This lazy design is why a method that returns a Mono or Flux commonly describes work for a caller or framework to compose rather than performing it immediately. Reactor 3 Reference Guide

Flux<String> names = Flux.just("Ada", "Linus")
    .map(String::toUpperCase);

// The chain above describes the work. A subscription starts it.
names.subscribe(System.out::println);

In application code, subscribing is often handled by a framework boundary, such as a WebFlux server, rather than by a service method. Keeping the publisher composable lets the caller combine it with other work and control its lifecycle. Subscription is also where demand and cancellation can participate in the flow.

How does backpressure work?

Backpressure is Reactor’s demand-management mechanism. A downstream subscriber requests a number of elements, and that request travels upstream so producers and intermediate operators can respond to demand. A subscriber may request a bounded number or request an unbounded amount, represented by Long.MAX_VALUE. Operators can reshape demand—for example, by buffering or prefetching—so the flow is push-pull rather than an unconstrained push from producer to consumer. Reactor 3 Reference Guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Demand is not the same as a fixed batch size. Requests can be bounded, and operators may request or buffer upstream according to their own behavior.
  • Backpressure does not remove the need to consider resource use. Buffering and prefetching affect how values are handled between stages; choose operators and concurrency boundaries with the workload in mind.
  • Cancellation matters too. A subscription is a lifecycle relationship, not just a callback: consumers can stop requesting work by cancelling, and a pipeline should be designed with that lifecycle in view.

What is the difference between publishOn and subscribeOn?

Schedulers control execution contexts; they do not automatically make blocking operations safe. publishOn changes the context used by downstream operators from its position in the chain onward. subscribeOn affects subscription and is largely independent of where it appears in the chain. Use them at deliberate concurrency boundaries, rather than adding scheduler switches to every pipeline. Threading and Schedulers

Blocking calls need particular care. The Reactor reference guide warns that block(), blockFirst(), and blockLast() on the default single or parallel schedulers can throw IllegalStateException. If unavoidable blocking work must be integrated, isolate it on an appropriate bounded-elastic or dedicated scheduler instead of running it on a non-blocking scheduler. Threading and Schedulers

Operator Effect How to reason about it
publishOn(scheduler) Changes the execution context for downstream operators after its position Place it where subsequent work should move to another context
subscribeOn(scheduler) Affects subscription and source execution context Use it to control where subscription begins; its effect is largely independent of its position in the chain

How does Reactor fit into Spring WebFlux?

Spring identifies Reactor as the reactive foundation for WebFlux and other parts of the Spring ecosystem. Spring Boot describes WebFlux as a fully asynchronous, non-blocking web framework that implements Reactive Streams through Reactor. WebFlux APIs commonly accept a Publisher and return Flux or Mono, allowing request and response processing to remain composable and backpressure-aware. Project Reactor · Reactive Web Applications

A controller can therefore return a publisher instead of blocking to construct the complete response first. The framework participates in subscribing to and consuming that publisher at the web boundary. Reactor is useful beyond WebFlux too: its publishers and operators can be used anywhere a JVM application needs asynchronous composition.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What tools and modules are part of the Reactor workflow?

The official documentation covers Reactor Core and its operators, reactor-test for testing, and Reactor Netty for HTTP, TCP, and UDP clients and servers. Project Reactor Documentation

  1. Represent an asynchronous result or sequence with Mono or Flux.
  2. Transform, filter, combine, or handle errors with operators while keeping the pipeline composable.
  3. Return the publisher to a framework boundary or subscribe when your application owns the subscription.
  4. Consider demand and cancellation, especially when connecting stages with different processing rates.
  5. Introduce schedulers only where a change of execution context is needed, and isolate blocking work.
  6. Test publisher behavior with Reactor Test; use virtual time for tests that depend on time-based behavior.
  7. Connect the pipeline to WebFlux or Reactor Netty when the application needs reactive web or network integration.

The Reactor documentation index listed stable BOM 2025.0.7 and Reactor Core 3.8.7 on page access in 2026. These are documentation-index version details, not a guarantee of the latest release at the time you read this; check the official documentation index for current release information.

How should you evaluate Reactor against another reactive library?

There is no sound basis here for declaring one reactive library faster than another. A useful comparison should be specific to your application and cover these dimensions:

  • Publisher cardinality types and how they express empty, single-result, and multi-value outcomes.
  • Reactive Streams and backpressure behavior, including how operators transform demand.
  • Operator vocabulary and error-handling model.
  • Scheduler and threading semantics, including how blocking work is isolated.
  • Integration with the frameworks and services your application already uses, such as Spring WebFlux, Spring Data, or Spring Cloud Gateway.
  • Testing support, including tools for verifying asynchronous behavior and virtual time.
  • Ecosystem and version cadence, checked against the project’s current official documentation.

The Reactor project site makes a qualitative claim that operators and schedulers can sustain “10’s of millions of messages per second,” but the cited page does not provide a test setup. Treat that as vendor context, not as a portable benchmark or a prediction of application performance. Reactor 3 Reference Guide

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.