From: Kai Moritz Date: Tue, 20 Feb 2024 12:02:09 +0000 (+0100) Subject: feat: Introduced counting of stored instances in `StorageStrategy` X-Git-Tag: rebase--2024-02-22~6 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=52cd388a7c2df8db3e97658c7fdf198701306584;p=demos%2Fkafka%2Fchat feat: Introduced counting of stored instances in `StorageStrategy` --- 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);