Class CollectionMessageStore
java.lang.Object
io.fluxcapacitor.javaclient.persisting.search.client.CollectionMessageStore
- All Implemented Interfaces:
Monitored<List<SerializedMessage>>
,HasMessageStore
,MessageStore
,AutoCloseable
A
MessageStore
implementation backed by a collection in an InMemorySearchStore
. This class provides
functionality for tracking updated documents in a specific collection.
Used to support HandleDocument
from in-memory search stores.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(List<SerializedMessage> messages) Appends a list of messages to the store.Retrieves a batch of messages starting from the givenminIndex
.registerMonitor
(Consumer<List<SerializedMessage>> monitor) Registers a monitor that will be notified when an activity of typeT
occurs.void
setRetentionTime
(Duration retentionPeriod) Sets the retention period for messages.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.tracking.MessageStore
append, close, getBatch, getMessageStore, unwrap
-
Constructor Details
-
CollectionMessageStore
public CollectionMessageStore()
-
-
Method Details
-
getBatch
Description copied from interface:MessageStore
Retrieves a batch of messages starting from the givenminIndex
.- Specified by:
getBatch
in interfaceMessageStore
- Parameters:
minIndex
- minimum message index to start frommaxSize
- maximum number of messages to retrieveinclusive
- whether to include the message atminIndex
- Returns:
- a list of
SerializedMessage
instances
-
registerMonitor
Description copied from interface:Monitored
Registers a monitor that will be notified when an activity of typeT
occurs.- Specified by:
registerMonitor
in interfaceMonitored<List<SerializedMessage>>
- Parameters:
monitor
- the callback to invoke with each observed value- Returns:
- a
Registration
that can be used to cancel the monitoring
-
append
Description copied from interface:MessageStore
Appends a list of messages to the store.- Specified by:
append
in interfaceMessageStore
- Parameters:
messages
- messages to append- Returns:
- a
CompletableFuture
that completes when the messages have been successfully appended
-
setRetentionTime
Description copied from interface:MessageStore
Sets the retention period for messages. Messages older than this duration may be removed depending on the implementation.- Specified by:
setRetentionTime
in interfaceMessageStore
- Parameters:
retentionPeriod
- duration to retain messages
-