From: Kai Moritz Date: Tue, 20 Feb 2024 07:23:13 +0000 (+0100) Subject: refactor: Moved succes/error-logging to outer stream-definitions X-Git-Tag: rebase--2024-02-20--15-07~11 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bd5b0cf7b9d19db59e9008900e322301f1961682;p=demos%2Fkafka%2Fchat refactor: Moved succes/error-logging to outer stream-definitions --- 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 c6c50172..99fe54d0 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);