Reactive Programming - Project Reactor - Mono
Table of Contents
Mono
https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html
A Mono is a Reactive Streams Publisher with basic rx operators that emits at most one item via the onNext signal then terminates with an onComplete signal (successful Mono, with or without value), or only emits a single onError signal (failed Mono).
- Can emit 0 or 1 item
- No stream
- Followed by an
onComplete
oronError
- No backpressure
- A lightweight publisher
- Request -> Response model
- Why do we need Mono at all? For convenience.
Working with a Mono
https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html

- As shown in the image, only one item will be published by the Publisher to the Subscriber. The last line represents the completion of the stream. The operator box represents the transform operation for this Mono stream.
- That transformation operation will be applied to the item of Mono stream using the onNext() method.
- The red X icon represents an error that happened when applying the transformation to the item and this is the onError().
- If no error happened, the transformation will be applied to the item successfully and using the onComplete() method.
Creating Mono publisher using the Factory methods
This can be used to support existing codebases.
Factory methods | Usage |
---|---|
just | when the value is in memory already |
empty | no item to emit |
error | emit error |
fromSupplier | defer execution by using Supplier<T> |
fromCallable | defer execution by using Callable<T> |
fromFuture | Publisher from CompletableFuture<T> |