How to use Mono.dematerialize()?

1.3k views Asked by At

As subject, I don't understand what is the use-case and how to use it.

Digging into the source code seems to be casting the mono itself from Mono<T> into Mono<Signal<X>.

1

There are 1 answers

2
Simon Baslé On BEST ANSWER

As indicated in the javadoc, dematerialize only makes sense if the Flux on which it is called is a Flux<Signal<T>>

It is the inverse of materialize, which aims at converting every signal in the source to onNext notifications.

Typical use would be to monitor all that happens in a Flux, not just value signals, then revert back to the original flux: to emulate the log() operator, you could use a materialize().doOnNext(System.out::println).dematerialize() for instance...