From f4326f5da8ae5773b037ebafa97030729d048558 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 20 Feb 2024 08:23:13 +0100 Subject: [PATCH] refactor: Moved succes/error-logging to outer stream-definitions --- .../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 61081635..6b290fdf 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 @@ -19,17 +19,18 @@ public interface StorageStrategy return writeChatRoomInfo( chatHomeService .getChatRoomInfo() - .doOnComplete(() -> log.info("Stored {}", chatHomeService)) - .doOnError(throwable -> log.error("Could not store {}: {}", chatHomeService, throwable)) .doOnNext(chatRoomInfo -> writeChatRoomData( chatRoomInfo.getId(), chatHomeService .getChatRoomData(chatRoomInfo.getId()) .flatMapMany(chatRoomData -> chatRoomData.getMessages()) - .doOnComplete(() -> log.info("Stored {}", chatRoomInfo)) - .doOnError(throwable -> log.error("Could not store {}: {}", chatRoomInfo, throwable))) - .subscribe())); + ) + .doOnComplete(() -> log.info("Stored {}", chatRoomInfo)) + .doOnError(throwable -> log.error("Could not store {}: {}", chatRoomInfo, throwable)) + .subscribe())) + .doOnComplete(() -> log.info("Stored {}", chatHomeService)) + .doOnError(throwable -> log.error("Could not store {}: {}", chatHomeService, throwable)); } Flux writeChatRoomInfo(Flux chatRoomInfoFlux); -- 2.20.1