I have read through the Javadocs for the reactor.core.publisher.Mono
class From project reactor However I still don't understand what's the point of having the Mono.never()
method.
What are some example use cases where one would use Mono.never()
?
It is very often used in tests (typically to assert timeout behavior), but can also have production usage: some operators take a control Publisher
as parameter in various situations where they need an asynchronous external signal to tell them to trigger some behavior. If in some cases you don't want said behavior to trigger, user never()
.
For instance, windowWhen
takes such parameter both for opening and closing windows (the later generated by a Function
). Conditionally returning a Mono.never()
you could have a window that never closes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With