With what I have read so far, one can multicast a Flux to multiple subscribers using ConnectableFlux
using something similar to following:
Flux<Integer> integerFlux = Flux.range(1, 50)
.log();
ConnectableFlux<Integer> integerConnectableFlux = integerFlux.publish();
integerConnectableFlux.map(i -> i*2)
.subscribe(System.out::println);
integerConnectableFlux.map(i -> i*3)
.subscribe(System.out::println);
integerConnectableFlux.connect();
To my limited understanding of reactive streams, above code converts a cold publisher to a hot publisher.
I am working on scenario where I have multiple subscribers for a Mono
. How can I get a hot publisher out of a Mono?