From: Kai Moritz Date: Wed, 20 Mar 2024 17:02:18 +0000 (+0100) Subject: test: HandoverIT-POC - `TestWriter` logs an error, if sending fails X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=030e72ea51952a527dbab226d5dac095b8d0b8b1;p=demos%2Fkafka%2Fchat test: HandoverIT-POC - `TestWriter` logs an error, if sending fails --- 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 aa3c6c10..8d65470a 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java @@ -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 -> {