From: Kai Moritz Date: Sun, 26 Feb 2023 14:30:20 +0000 (+0100) Subject: refactor: `ChatRoomFactory` returns real `ChatRoom`s X-Git-Tag: rebase--2023-08-20~20 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=40b27168d58ffc1a4837c52fad98655b231cb4b2;p=demos%2Fkafka%2Fchat refactor: `ChatRoomFactory` returns real `ChatRoom`s - `ChatHomeService` only deals with real `ChatRoom`s. - Hence, there is no need for `ChatRoomFactory`, to return the simplified interface `ChatRoomInfo`. - This is, because the implementation specific logic is implemented in the `ChatHomeService`, not `ChatHome` itself: the actual implementation is hidden behind that service (and behind the service `ChatRoomService` in the domain-class `ChatRoom`). --- 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 603795d9..324e4b02 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 @@ -7,5 +7,5 @@ import java.util.UUID; public interface ChatRoomFactory { - Mono createChatRoom(UUID id, String name); + Mono createChatRoom(UUID id, String name); } diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/InMemoryChatRoomFactory.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/InMemoryChatRoomFactory.java index 2bde2361..9872ccb1 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/InMemoryChatRoomFactory.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/InMemoryChatRoomFactory.java @@ -21,7 +21,7 @@ public class InMemoryChatRoomFactory implements ChatRoomFactory @Override - public Mono createChatRoom(UUID id, String name) + public Mono createChatRoom(UUID id, String name) { log.info("Creating ChatRoom with buffer-size {}", bufferSize); int shard = shardingStrategy.selectShard(id);