From 534c8729503165ab6f247bd22435ef8f88117d8b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 18 Feb 2024 16:10:07 +0100 Subject: [PATCH] WIP:callbacks --- .../backend/implementation/StorageStrategy.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 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 ba8bc23a..9fb115e3 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 @@ -34,8 +34,8 @@ public interface StorageStrategy writeChatRoomData( chatRoomId, messageFlux, - (id) -> log.info("Successfully stored chat-room {}", id), - (id, throwable) -> log.error("Could not store chat-room {}: {}", id, throwable)); + (id) -> logSuccess(id), + (id, throwable) -> logFailure(id, throwable)); } void writeChatRoomInfo(Flux chatRoomInfoFlux); @@ -49,4 +49,14 @@ public interface StorageStrategy interface SuccessCallback extends Consumer {} interface FailureCallback extends BiConsumer {} + + default void logSuccess(UUID chatRoomId) + { + log.info("Successfully stored chat-room {}", chatRoomId); + } + + default void logFailure(UUID chatRoomId, Throwable throwable) + { + log.error("Could not store chat-room {}: {}", chatRoomId, throwable); + } } -- 2.20.1