feat: Added counting of restored instances
authorKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 15:14:22 +0000 (16:14 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 16:27:17 +0000 (17:27 +0100)
src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/InMemoryChatMessageService.java
src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java

index 0345c00..4f022e8 100644 (file)
@@ -22,8 +22,8 @@ public class InMemoryChatMessageService implements ChatMessageService
     messages = new LinkedHashMap<>();
     messageFlux
         .doOnNext(message -> messages.put(message.getKey(), message))
-        .then()
-        .doOnSuccess(empty -> log.info("Restored InMemoryChatMessageService"))
+        .count()
+        .doOnSuccess(count -> log.info("Restored InMemoryChatMessageService with {} messages", count))
         .doOnError(throwable -> log.error("Could not restore InMemoryChatMessageService"))
         .block();
   }
index dfe8567..bc8d92e 100644 (file)
@@ -76,8 +76,8 @@ public class SimpleChatHomeService implements ChatHomeService
                   new InMemoryChatMessageService(messageFlux),
                   bufferSize));
         })
-        .then()
-        .doOnSuccess(empty -> log.info("Restored {}", this))
+        .count()
+        .doOnSuccess(count -> log.info("Restored {} with {} chat-rooms", this, count))
         .doOnError(throwable -> log.error("Could not restore {}", this))
         .block();