From: Kai Moritz Date: Fri, 1 Mar 2024 18:55:16 +0000 (+0100) Subject: WIP:test: HandoverIT-POC - Refactored `TestWriter` to use a `Flux` X-Git-Tag: rebase--2024-03-03--11-38~12 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=d89b86b82b4c57245dcc2042eea168aaad727087;p=demos%2Fkafka%2Fchat WIP:test: HandoverIT-POC - Refactored `TestWriter` to use a `Flux` --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java index 08634b8a..267519e1 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java @@ -44,6 +44,11 @@ public class TestWriter implements Runnable .flatMap(message -> sendMessage(chatRoom, message) .delayElement(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500))) .retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1)))) + .doOnNext(message -> log.info( + "{} sent a message to {}: {}", + user, + chatRoom, + message)) .doOnError(throwable -> { WebClientResponseException e = (WebClientResponseException)throwable.getCause(); @@ -52,11 +57,6 @@ public class TestWriter implements Runnable user, e.getResponseBodyAsString(Charset.defaultCharset())); }) - .doOnNext(message -> log.info( - "{} sent a message to {}: {}", - user, - chatRoom, - message)) .then() .block(); }