@ThreadSafe public class CompactingConcurrentMapMessageStore extends java.lang.Object implements MessageStore
of.
The ordering of entries is guaranteed by using a (on-heap) ConcurrentSkipListSet for keys.
The entries are stored in a ConcurrentMap like, for example, ChronicleMap. This way, the entries can be stored off-heap, so large numbers of entries can be stored in memory, without getting problems with Java garbage-collecting.
| Constructor and Description |
|---|
CompactingConcurrentMapMessageStore(java.lang.String name,
boolean removeNullPayloadMessages,
java.util.concurrent.ConcurrentMap<java.lang.String,MessageStoreEntry> messageMap) |
CompactingConcurrentMapMessageStore(java.lang.String name,
boolean removeNullPayloadMessages,
java.util.concurrent.ConcurrentMap<java.lang.String,MessageStoreEntry> messageMap,
Indexer indexer) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(MessageStoreEntry entry)
Appends the specified element to the end of this list (optional
operation).
|
java.util.Set<java.lang.String> |
getChannelNames()
Returns a set containing the channel names of the messages contained in the
MessageStore |
com.google.common.collect.ImmutableSet<Index> |
getIndexes() |
ChannelPosition |
getLatestChannelPosition(java.lang.String channelName)
Returns the latest
ChannelPosition of the given channel, derived from the messages contained in this
MessageStore. |
java.lang.String |
getName()
Returns the name of the message store.
|
int |
size()
Returns the number of messages contained in the MessageStore.
|
java.util.stream.Stream<MessageStoreEntry> |
stream()
Returns a Stream of all entries contained in the MessageStore.
|
java.util.stream.Stream<MessageStoreEntry> |
stream(Index index,
java.lang.String value)
Returns a Stream of all entries contained in the MessageStore that have are matching the given Index value
(optional operation).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getLatestChannelPositionpublic CompactingConcurrentMapMessageStore(java.lang.String name,
boolean removeNullPayloadMessages,
java.util.concurrent.ConcurrentMap<java.lang.String,MessageStoreEntry> messageMap)
public CompactingConcurrentMapMessageStore(java.lang.String name,
boolean removeNullPayloadMessages,
java.util.concurrent.ConcurrentMap<java.lang.String,MessageStoreEntry> messageMap,
Indexer indexer)
public java.lang.String getName()
MessageStoreEspecially for persistent implementations, two MessageStore instances might use this property
to identify the underlying database, collection, file etc.
getName in interface MessageStorepublic void add(MessageStoreEntry entry)
MessageStoreMessageStores that support this operation may place limitations on what
elements may be added to this list. In particular, some
stores will refuse to add entries for more than a single
channel. MessageStore
classes should clearly specify in their documentation any restrictions
on what elements may be added.
add in interface MessageStoreentry - element to be appended to this message storepublic java.util.Set<java.lang.String> getChannelNames()
MessageStoreMessageStoregetChannelNames in interface MessageStorepublic com.google.common.collect.ImmutableSet<Index> getIndexes()
getIndexes in interface MessageStorepublic ChannelPosition getLatestChannelPosition(java.lang.String channelName)
MessageStoreChannelPosition of the given channel, derived from the messages contained in this
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 MessageStorechannelName - the name of the channelpublic java.util.stream.Stream<MessageStoreEntry> stream()
MessageStoreThe stream will maintain the insertion order of the entries.
stream in interface MessageStorepublic java.util.stream.Stream<MessageStoreEntry> stream(Index index, java.lang.String value)
MessageStoreThe stream will maintain the insertion order of the entries.
stream in interface MessageStoreindex - the Indexvalue - the value identifying the requested messages in the specified indexpublic 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