Utility methods

Mono offers methods to generate empty/error streams or to convert an existing Reactive Stream publisher to Mono. These methods are required to generate streams that can be combined with others by using the available operators, as follows:

  • Mono.empty: Generates a stream with no value and only a completion.
  • Mono.error: Generates a stream with no value and only a specified error.
  • Mono.never: Generates a stream with no events at all. It does not generate an event of any type.
  • Mono.from: Generates a Mono stream from an existing stream publisher.
  • Mono.defer: This method is used to build a lazy reactive publisher. It also takes a Java 8 supplier to instantiate a subscription-specific Reactive Stream publisher. The publisher instance ...

Get Hands-On Reactive Programming with Reactor now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.