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-22~3 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bb10ea659988bc5a2f28557697f6ee249de9223b;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 0345c008..4f022e89 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 @@ -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(); } 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 dfe8567a..bc8d92eb 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 @@ -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();