test: HandoverIT-POC - Added logging for complete/error to listener
authorKai Moritz <kai@juplo.de>
Mon, 11 Mar 2024 17:14:17 +0000 (18:14 +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/TestListener.java

index 78d4c82..95a8ff8 100644 (file)
@@ -28,7 +28,7 @@ public class TestListener
         .fromArray(chatRooms)
         .flatMap(chatRoom ->
         {
-          log.info("Requesting messages from chat-room {}", chatRoom);
+          log.info("Requesting messages for chat-room {}", chatRoom);
           List<MessageTo> list = new LinkedList<>();
           receivedMessages.put(chatRoom.getId(), list);
           return receiveMessages(chatRoom)
@@ -43,7 +43,9 @@ public class TestListener
                   return Mono.error(e);
                 }
               })
-              .doOnNext(message -> list.add(message));
+              .doOnNext(message -> list.add(message))
+              .doOnComplete(() -> log.info("Listening to {} was completed!", chatRoom))
+              .doOnError(throwalbe -> log.error("Listening to {} failed!", chatRoom, throwalbe));
         });
   }