@ThreadSafe public class CompactingInMemoryMessageStore extends java.lang.Object implements WritableMessageStore
of.
Messages are stored using a ConcurrentNavigableMap.
| Constructor and Description |
|---|
CompactingInMemoryMessageStore() |
CompactingInMemoryMessageStore(boolean removeNullPayloadMessages) |
| 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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic CompactingInMemoryMessageStore()
public CompactingInMemoryMessageStore(boolean removeNullPayloadMessages)
public void add(Message<java.lang.String> message)
add in interface WritableMessageStorepublic 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()
MessageStorePrimarily used for testing purposes. If the MessageStore can not implement this without major performance impacts (like, for example, having to download and parse huge files from S3), the method is not required to be implemented.
size in interface MessageStore