Package de.otto.synapse.messagestore
Class DelegatingSnapshotMessageStore
- java.lang.Object
-
- de.otto.synapse.messagestore.DelegatingSnapshotMessageStore
-
- All Implemented Interfaces:
MessageStore,SnapshotMessageStore,java.lang.AutoCloseable
public class DelegatingSnapshotMessageStore extends java.lang.Object implements SnapshotMessageStore
-
-
Constructor Summary
Constructors Constructor Description DelegatingSnapshotMessageStore(MessageStore delegate)
-
Method Summary
Modifier and Type Method Description voidadd(MessageStoreEntry entry)Deprecated.Unsupported operation.voidclose()java.util.Set<java.lang.String>getChannelNames()Returns a set containing the channel names of the messages contained in theMessageStorecom.google.common.collect.ImmutableSet<Index>getIndexes()ChannelPositiongetLatestChannelPosition()Deprecated.ChannelPositiongetLatestChannelPosition(java.lang.String channelName)Returns the latestChannelPositionof the given channel, derived from the messages contained in thisMessageStore.java.time.InstantgetSnapshotTimestamp()longsize()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).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.otto.synapse.messagestore.MessageStore
isCompacting
-
-
-
-
Constructor Detail
-
DelegatingSnapshotMessageStore
public DelegatingSnapshotMessageStore(MessageStore delegate)
-
-
Method Detail
-
getSnapshotTimestamp
public java.time.Instant getSnapshotTimestamp()
- Specified by:
getSnapshotTimestampin interfaceSnapshotMessageStore
-
getChannelNames
public java.util.Set<java.lang.String> getChannelNames()
Description copied from interface:MessageStoreReturns a set containing the channel names of the messages contained in theMessageStore- Specified by:
getChannelNamesin interfaceMessageStore- Returns:
- set of channel names
-
getIndexes
public com.google.common.collect.ImmutableSet<Index> getIndexes()
- Specified by:
getIndexesin interfaceMessageStore
-
getLatestChannelPosition
public ChannelPosition getLatestChannelPosition(java.lang.String channelName)
Description copied from interface:MessageStoreReturns the latestChannelPositionof the given channel, derived from the messages contained in thisMessageStore.The position is calculated by
mergingtheoptional positionsof the messages.Messages without positions will not change the latest ChannelPosition. If no message contains position information, the returned ChannelPosition is
ChannelPosition.fromHorizon()- Specified by:
getLatestChannelPositionin interfaceMessageStore- Parameters:
channelName- the name of the channel- Returns:
- ChannelPosition
-
getLatestChannelPosition
@Deprecated public ChannelPosition getLatestChannelPosition()
Deprecated.- Specified by:
getLatestChannelPositionin interfaceMessageStore
-
stream
public java.util.stream.Stream<MessageStoreEntry> stream()
Description copied from interface:MessageStoreReturns a Stream of all entries contained in the MessageStore.The stream will maintain the insertion order of the entries.
- Specified by:
streamin interfaceMessageStore- Returns:
- Stream of entries
-
stream
public java.util.stream.Stream<MessageStoreEntry> stream(Index index, java.lang.String value)
Description copied from interface:MessageStoreReturns a Stream of all entries contained in the MessageStore that have are matching the given Index value (optional operation).The stream will maintain the insertion order of the entries.
- Specified by:
streamin interfaceMessageStore- Parameters:
index- the Indexvalue- the value identifying the requested messages in the specified index- Returns:
- stream of message-store entries matching the index or emptyStream, if the index is not known, or if there are no entries
-
add
@Deprecated public void add(@Nonnull MessageStoreEntry entry)Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the message store unmodified.- Specified by:
addin interfaceMessageStore- Parameters:
entry- element to be appended to this message store- Throws:
java.lang.UnsupportedOperationException- always
-
size
public long size()
Description copied from interface:MessageStoreReturns the number of messages contained in the MessageStore.Primarily 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.
- Specified by:
sizein interfaceMessageStore- Returns:
- number of messages
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceMessageStore
-
-