From bb10ea659988bc5a2f28557697f6ee249de9223b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 20 Feb 2024 16:14:22 +0100 Subject: [PATCH] feat: Added counting of restored instances --- .../implementation/inmemory/InMemoryChatMessageService.java | 4 ++-- .../implementation/inmemory/SimpleChatHomeService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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(); -- 2.20.1