I have a use case when I should send email to the users. First I create email body.
Mono<String> emailBody = ...cache();
Run Code Online (Sandbox Code Playgroud)
And then I select users and send the email to them:
Flux.fromIterable(userRepository.findAllByRole(Role.USER))
.map(User::getEmail)
.doOnNext(email -> sendEmail(email, emailBody.block(), massSendingSubject))
.subscribe();
Run Code Online (Sandbox Code Playgroud)
What I don't like