* Switched from `Mono.from(..).delayElement()` to `Mono.delay().then()`.
* This does _not_ solve the problem, that all delays are calculated and
scheduled, when the `Flux` is created.
}
})
.map(i -> "Message #" + i)
- .flatMap(message -> sendMessage(chatRoom, message)
- .delayElement(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500)))
- .retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1))))
+ .flatMap(message -> Mono
+ .delay(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500)))
+ .thenMany(sendMessage(chatRoom, message).retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1)))))
.doOnNext(message ->
{
sentMessages.add(message);