projects
/
demos
/
kafka
/
chat
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f0113ff
)
feat: `Chatroom.getMessages()` is fully paginated (takes first and last)
author
Kai Moritz
<kai@juplo.de>
Wed, 28 Dec 2022 16:20:53 +0000
(17:20 +0100)
committer
Kai Moritz
<kai@juplo.de>
Sun, 15 Jan 2023 18:35:59 +0000
(19:35 +0100)
src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java
patch
|
blob
|
history
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
62c9732
..
115dcd6
100644
(file)
--- a/
src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java
+++ b/
src/main/java/de/juplo/kafka/chat/backend/domain/Chatroom.java
@@
-72,12
+72,16
@@
public class Chatroom
return sink.asFlux();
}
- public Stream<Message> getMessages(long first
Message
)
+ public Stream<Message> getMessages(long first
, long last
)
{
return messages
.values()
.stream()
- .filter(message -> message.getSerialNumber() >= firstMessage);
+ .filter(message ->
+ {
+ long serial = message.getSerialNumber();
+ return serial >= first && serial <= last;
+ });
}