mono
8 article(s) with this tag
-
24 Apr 2026
💊 #22: That time repeat() + empty() melted my CPU
A Mono.empty() put inside a repeat() becomes a silent hot loop: millions of subscriptions per second, CPU at 100% and zero elements emitted. A test to reproduce it and a few ideas to avoid it.
-
21 Jun 2025
💊 #14: Is Mono a lazybones? It depends!
Mono.just() evaluates its argument immediately (eager), Mono.fromCallable() defers execution until subscription (lazy): handy for potentially blocking operations.
-
17 Jun 2025
💊 #13: Where does the Mono run?
A Mono's execution thread changes when you use subscribeOn(): by default it's the subscriber's thread, with boundedElastic() it moves to the pool dedicated to blocking I/O operations.
-
24 Mar 2025
💊 #12: The zip methods with a combinator
Using the combinator variants of Mono.zip, zipWith and zipWhen to get a well-typed object directly instead of a Tuple2, plus a custom helper for the N-Mono case (with N > 2).
-
06 Nov 2024
💊 #8: Eager and lazy strategies compared with Optional and Mono (WebFlux)
Differences between orElse and orElseGet on Optional, switchIfEmpty with and without defer on Mono: eager vs lazy strategies and when to pick each one to avoid side-effects.
-
03 Sep 2024
💊 #4: Handling a Mono<Mono<Void>> in WebFlux – the subscribe method
Two ways to handle a Mono<Mono<Void>> in WebFlux: explicit subscribe() and flatMap + then().
-
29 Aug 2024
💊 #3: Optimising your code with WebFlux – the zipWhen method
Replacing flatMap + Mono.zip with zipWhen to chain two dependent operations in WebFlux: more concise code, with a Tuple2 as output.
-
20 Aug 2024
💊 #1: Optimising your code with WebFlux – the doOnNext method
How to use doOnNext in WebFlux for side-effects (updates, logging, etc.) without breaking the data-flow, improving readability and maintainability.