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: TEST~63 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=347bcb93542a69f456c4d3d3ed5d15aa0f9027a5;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; - }); + })); }