From: Kai Moritz Date: Wed, 28 Dec 2022 16:38:00 +0000 (+0100) Subject: refactor: Streamlined API of `Chatroom` - all return-types are reactive X-Git-Tag: wip~93 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=bb86037c439adea0f2befde98571eaf966c9a5e0;p=demos%2Fkafka%2Fchat refactor: Streamlined API of `Chatroom` - all return-types are reactive --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java b/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java index 115dcd69..e1638aa9 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java @@ -10,7 +10,6 @@ import reactor.core.publisher.Sinks; import java.time.LocalDateTime; import java.util.*; -import java.util.stream.Stream; @RequiredArgsConstructor @@ -72,16 +71,16 @@ public class Chatroom return sink.asFlux(); } - public Stream getMessages(long first, long last) + public Flux getMessages(long first, long last) { - return messages + return Flux.fromStream(messages .values() .stream() .filter(message -> { long serial = message.getSerialNumber(); return serial >= first && serial <= last; - }); + })); }