From: Kai Moritz Date: Mon, 4 Sep 2023 19:21:03 +0000 (+0200) Subject: refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code X-Git-Tag: rebase--2023-09-05--23-53~19 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=0f0ae350deac95a118dd46490c8affb475bfe633;p=demos%2Fkafka%2Fchat refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java index 5c497316..511b9ade 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomData.java @@ -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 diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java index 862c7048..51147c51 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/SimpleChatHome.java @@ -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); }