refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code
authorKai Moritz <kai@juplo.de>
Mon, 4 Sep 2023 19:21:03 +0000 (21:21 +0200)
committerKai Moritz <kai@juplo.de>
Mon, 4 Sep 2023 19:21:03 +0000 (21:21 +0200)
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java
src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java

index 5c49731..511b9ad 100644 (file)
@@ -8,7 +8,6 @@ import reactor.core.publisher.SynchronousSink;
 
 import java.time.Clock;
 import java.time.LocalDateTime;
-import java.util.UUID;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -25,13 +24,13 @@ public class ChatRoomData
 
 
   public ChatRoomData(
-      ChatRoomService service,
       Clock clock,
+      ChatRoomService service,
       int bufferSize)
   {
     log.info("Created ChatRoom with buffer-size {}", bufferSize);
-    this.service = service;
     this.clock = clock;
+    this.service = service;
     this.bufferSize = bufferSize;
     // @RequiredArgsConstructor unfortunately not possible, because
     // the `bufferSize` is not set, if `createSink()` is called
index 862c704..51147c5 100644 (file)
@@ -75,8 +75,8 @@ public class SimpleChatHome implements ChatHome
           chatRoomData.put(
               info.getId(),
               new ChatRoomData(
-                  chatRoomServiceFactory.create(messageFlux),
                   clock,
+                  chatRoomServiceFactory.create(messageFlux),
                   bufferSize));
         });
     this.clock = clock;
@@ -90,7 +90,7 @@ public class SimpleChatHome implements ChatHome
     log.info("Creating ChatRoom with buffer-size {}", bufferSize);
     ChatRoomService service = new InMemoryChatRoomService(Flux.empty());
     ChatRoomInfo chatRoomInfo = new ChatRoomInfo(id, name, shard);
-    ChatRoomData chatRoomData = new ChatRoomData(service, clock, bufferSize);
+    ChatRoomData chatRoomData = new ChatRoomData(clock, service, bufferSize);
     this.chatRoomData.put(id, chatRoomData);
     return Mono.just(chatRoomInfo);
   }