@ThreadSafe public class InMemoryMessageStore extends java.lang.Object implements MessageStore
| Constructor and Description |
|---|
InMemoryMessageStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Message<java.lang.String> message) |
ChannelPosition |
getLatestChannelPosition()
Returns the latest
ChannelPosition of the MessageStore. |
int |
size()
Returns the number of messages contained in the MessageStore.
|
java.util.stream.Stream<Message<java.lang.String>> |
stream()
Returns a Stream of
messages contained in the MessageStore. |
public void add(Message<java.lang.String> message)
add in interface MessageStorepublic ChannelPosition getLatestChannelPosition()
MessageStoreChannelPosition of the MessageStore.
The position is calculated by merging the
optional positions of the messages.
Messages without positions will not change the latest ChannelPosition. If no message contains
position information, the returned ChannelPosition is ChannelPosition.fromHorizon()
getLatestChannelPosition in interface MessageStorepublic java.util.stream.Stream<Message<java.lang.String>> stream()
MessageStoremessages contained in the MessageStore.
The stream will maintain the insertion order of the messages.
stream in interface MessageStorepublic int size()
MessageStoresize in interface MessageStore