test: HandoverIT-POC - `TestWriter` logs an error, if sending fails
authorKai Moritz <kai@juplo.de>
Wed, 20 Mar 2024 17:02:18 +0000 (18:02 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 22 Mar 2024 16:39:20 +0000 (17:39 +0100)
src/test/java/de/juplo/kafka/chat/backend/TestWriter.java

index aa3c6c1..8d65470 100644 (file)
@@ -45,7 +45,15 @@ public class TestWriter
         .delayElements(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500)))
         .map(i -> "Message #" + i)
         .concatMap(message -> sendMessage(chatRoom, message)
-            .log(user.getName())
+            .doOnError(throwable ->
+            {
+              WebClientResponseException e = (WebClientResponseException)throwable;
+              log.info(
+                "could not send message {} for {}: {}",
+                message,
+                user.getName(),
+                e.getResponseBodyAsString());
+            })
             .retryWhen(Retry.fixedDelay(60, Duration.ofSeconds(1))))
         .doOnNext(message ->
         {