From: Kai Moritz Date: Mon, 4 Sep 2023 19:14:12 +0000 (+0200) Subject: refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code X-Git-Tag: rebase--2023-09-05--23-53~20 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=96f554e9792669bf83c9ce6cbbf3257481d82e16;p=demos%2Fkafka%2Fchat refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java index b631ed51..257c6db5 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatRoomChannel.java @@ -362,7 +362,7 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener .toArray(); } - Mono getChatRoom(int shard, UUID id) + Mono getChatRoomData(int shard, UUID id) { if (loadInProgress) { @@ -377,7 +377,7 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener return Mono.justOrEmpty(chatrooms[shard].get(id)); } - Flux getChatRooms() + Flux getChatRoomData() { return Flux .fromStream(IntStream.range(0, numShards).mapToObj(i -> Integer.valueOf(i))) diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java index cea178b2..c2e95d4d 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHome.java @@ -34,7 +34,7 @@ public class KafkaChatHome implements ChatHome { int shard = selectShard(id); return chatRoomChannel - .getChatRoom(shard, id) + .getChatRoomData(shard, id) .switchIfEmpty(Mono.error(() -> new UnknownChatroomException( id, shard, @@ -44,7 +44,7 @@ public class KafkaChatHome implements ChatHome @Override public Flux getChatRoomInfo() { - return chatRoomChannel.getChatRooms(); + return chatRoomChannel.getChatRoomData(); } @Override @@ -52,7 +52,7 @@ public class KafkaChatHome implements ChatHome { int shard = selectShard(id); return chatRoomChannel - .getChatRoom(shard, id) + .getChatRoomData(shard, id) .switchIfEmpty(Mono.error(() -> new UnknownChatroomException( id, shard, @@ -62,7 +62,7 @@ public class KafkaChatHome implements ChatHome @Override public Flux getChatRoomData() { - return chatRoomChannel.getChatRooms(); + return chatRoomChannel.getChatRoomData(); } int selectShard(UUID chatRoomId)