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>
Thu, 22 Feb 2024 15:54:48 +0000 (16:54 +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 7d4b9b6..5d5feb8 100644 (file)
@@ -33,9 +33,10 @@ public class InMemoryChatMessageService implements ChatMessageService
 
     return messageFlux
         .doOnNext(message -> messages.put(message.getKey(), message))
-        .then()
-        .doOnSuccess(empty -> log.info("Restored InMemoryChatMessageService"))
-        .doOnError(throwable -> log.error("Could not restore InMemoryChatMessageService"));
+        .count()
+        .doOnSuccess(count -> log.info("Restored InMemoryChatMessageService with {} messages", count))
+        .doOnError(throwable -> log.error("Could not restore InMemoryChatMessageService"))
+        .then();
   }
 
   @Override
index 371d4a8..d568a9b 100644 (file)
@@ -85,9 +85,10 @@ public class SimpleChatHomeService implements ChatHomeService
 
           return chatMessageService.restore(storageStrategy);
         })
-        .then()
-        .doOnSuccess(empty -> log.info("Restored {}", this))
-        .doOnError(throwable -> log.error("Could not restore {}", this));
+        .count()
+        .doOnSuccess(count -> log.info("Restored {} with {} chat-rooms", this, count))
+        .doOnError(throwable -> log.error("Could not restore {}", this))
+        .then();
   }