From 0f0ae350deac95a118dd46490c8affb475bfe633 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 4 Sep 2023 21:21:03 +0200 Subject: [PATCH] refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code --- .../de/juplo/kafka/chat/backend/domain/ChatRoomData.java | 5 ++--- .../chat/backend/persistence/inmemory/SimpleChatHome.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) 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); } -- 2.20.1