From b159d9543cdb96b4d600bff8dacf79a7f5fff20f Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 8 Jan 2023 09:53:03 +0100 Subject: [PATCH] refactor: Only `LocalJsonFileStorageStrategy` restores `Chatroom`s --- .../de/juplo/kafka/chat/backend/ChatBackendConfiguration.java | 4 ++-- .../de/juplo/kafka/chat/backend/domain/ChatroomFactory.java | 1 - .../chat/backend/persistence/InMemoryChatroomFactory.java | 1 - .../backend/persistence/LocalJsonFilesStorageStrategy.java | 3 +-- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java index b590854e..b9d1d29c 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java @@ -30,7 +30,7 @@ public class ChatBackendConfiguration public StorageStrategy storageStrategy( ChatBackendProperties properties, ObjectMapper mapper, - ChatroomFactory chatroomFactory) + InMemoryChatroomFactory chatroomFactory) { return new LocalJsonFilesStorageStrategy( Paths.get(properties.getDatadir()), @@ -39,7 +39,7 @@ public class ChatBackendConfiguration } @Bean - ChatroomFactory chatroomFactory(ChatBackendProperties properties) + InMemoryChatroomFactory chatroomFactory(ChatBackendProperties properties) { return new InMemoryChatroomFactory(properties.getChatroomBufferSize()); } diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatroomFactory.java b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatroomFactory.java index f5e8c19b..6e770958 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatroomFactory.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatroomFactory.java @@ -6,5 +6,4 @@ import java.util.UUID; public interface ChatroomFactory { Chatroom createChatroom(UUID id, String name); - Chatroom restoreChatroom(UUID id, String name, Strategy strategy); } diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatroomFactory.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatroomFactory.java index a405be9e..6e4985ed 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatroomFactory.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatroomFactory.java @@ -22,7 +22,6 @@ public class InMemoryChatroomFactory implements ChatroomFactory