From: Kai Moritz Date: Mon, 11 Sep 2023 14:10:22 +0000 (+0200) Subject: refactor: Removed unused methods X-Git-Tag: rebase--2024-02-03--15-10~27 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9e0f291d1f1f865bc16c3813da34ba6bc67042d3;p=demos%2Fkafka%2Fchat refactor: Removed unused methods --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java index 64cd7e13..06c197bf 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java @@ -90,15 +90,6 @@ public class ShardedChatHomeService implements ChatHomeService : throwable); } - public Flux getChatRoomData() - { - return Flux - .fromIterable(ownedShards) - .flatMap(shard -> chatHomes[shard].getChatRoomData()); - } - - - private int selectShard(UUID chatroomId) { return shardingStrategy.selectShard(chatroomId); diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java index 61b36ee8..da01a541 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java @@ -114,9 +114,4 @@ public class SimpleChatHomeService implements ChatHomeService .justOrEmpty(chatRoomData.get(id)) .switchIfEmpty(Mono.error(() -> new UnknownChatroomException(id))); } - - public Flux getChatRoomData() - { - return Flux.fromIterable(chatRoomData.values()); - } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java index 7f7d28e6..4143616d 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java @@ -425,12 +425,4 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener return Mono.justOrEmpty(chatRoomInfo[shard].get(id)); } - - Flux getChatRoomData() - { - return Flux - .fromStream(IntStream.range(0, numShards).mapToObj(i -> Integer.valueOf(i))) - .filter(shard -> isShardOwned[shard]) - .flatMap(shard -> Flux.fromIterable(chatRoomData[shard].values())); - } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java index 0769caf1..5019ed20 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java @@ -59,11 +59,6 @@ public class KafkaChatHomeService implements ChatHomeService chatRoomChannel.getOwnedShards()))); } - public Flux getChatRoomData() - { - return chatRoomChannel.getChatRoomData(); - } - int selectShard(UUID chatRoomId) { byte[] serializedKey = chatRoomId.toString().getBytes(); diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java index 70cac508..17d3a397 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java @@ -1,10 +1,7 @@ package de.juplo.kafka.chat.backend.implementation.kafka.messages; -import de.juplo.kafka.chat.backend.domain.Message; import lombok.*; -import java.time.LocalDateTime; - @Getter @Setter @@ -23,20 +20,6 @@ public class EventChatMessageReceivedTo extends AbstractMessageTo } - public Message toMessage(long offset, LocalDateTime timestamp) - { - return new Message(Message.MessageKey.of(user, id), offset, timestamp, text); - } - - public static EventChatMessageReceivedTo from(Message message) - { - return EventChatMessageReceivedTo.of( - message.getUsername(), - message.getId(), - message.getMessageText()); - } - - public static EventChatMessageReceivedTo of(String user, Long id, String text) { EventChatMessageReceivedTo to = new EventChatMessageReceivedTo();