From: Kai Moritz Date: Tue, 20 Feb 2024 15:14:22 +0000 (+0100) Subject: feat: Added counting of restored instances X-Git-Tag: rebase--2024-02-23--16-28~18 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=4f2a6dfe5a1c620ad795328853c1be71a2581771;p=demos%2Fkafka%2Fchat feat: Added counting of restored instances --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/InMemoryChatMessageService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/InMemoryChatMessageService.java index 7d4b9b62..5d5feb87 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/InMemoryChatMessageService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/InMemoryChatMessageService.java @@ -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 diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java index 371d4a87..d568a9b4 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java @@ -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(); }