From 52cd388a7c2df8db3e97658c7fdf198701306584 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 20 Feb 2024 13:02:09 +0100 Subject: [PATCH] feat: Introduced counting of stored instances in `StorageStrategy` --- .../chat/backend/implementation/StorageStrategy.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/StorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/StorageStrategy.java index 647ac523..87208dce 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/StorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/StorageStrategy.java @@ -24,12 +24,13 @@ public interface StorageStrategy .getChatRoomData(chatRoomInfo.getId()) .flatMapMany(chatRoomData -> chatRoomData.getMessages()) ) - .then() - .doOnSuccess(empty -> log.info("Stored {}", chatRoomInfo)) + .count() + .doOnSuccess(count -> log.info("Stored {} messages for {}", count, chatRoomInfo)) .doOnError(throwable -> log.error("Could not store {}: {}", chatRoomInfo, throwable))) - .then() - .doOnSuccess(empty -> log.info("Stored {}", chatHomeService)) - .doOnError(throwable -> log.error("Could not store {}: {}", chatHomeService, throwable)); + .count() + .doOnSuccess(count -> log.info("Stored {} chat-rooms for {}", count, chatHomeService)) + .doOnError(throwable -> log.error("Could not store {}: {}", chatHomeService, throwable)) + .then(); } Flux writeChatRoomInfo(Flux chatRoomInfoFlux); -- 2.20.1