refactor: `ChatRoomFactory` returns real `ChatRoom`s
authorKai Moritz <kai@juplo.de>
Sun, 26 Feb 2023 14:30:20 +0000 (15:30 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 20 Aug 2023 08:44:31 +0000 (10:44 +0200)
- `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`).

src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomFactory.java
src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/InMemoryChatRoomFactory.java

index 603795d..324e4b0 100644 (file)
@@ -7,5 +7,5 @@ import java.util.UUID;
 
 public interface ChatRoomFactory
 {
-  Mono<ChatRoomInfo> createChatRoom(UUID id, String name);
+  Mono<ChatRoom> createChatRoom(UUID id, String name);
 }
index 2bde236..9872ccb 100644 (file)
@@ -21,7 +21,7 @@ public class InMemoryChatRoomFactory implements ChatRoomFactory
 
 
   @Override
-  public Mono<ChatRoomInfo> createChatRoom(UUID id, String name)
+  public Mono<ChatRoom> createChatRoom(UUID id, String name)
   {
     log.info("Creating ChatRoom with buffer-size {}", bufferSize);
     int shard = shardingStrategy.selectShard(id);