From: Kai Moritz Date: Sun, 26 Feb 2023 14:30:20 +0000 (+0100) Subject: refactor: `ChatRoomFactory` returns real `ChatRoom`s X-Git-Tag: kafkadata~52 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=4d8c110dce80cdc2c1819785fb71739fbe9ee9c1;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);