Class CollectionMessageStore

java.lang.Object
io.fluxcapacitor.javaclient.persisting.search.client.CollectionMessageStore
All Implemented Interfaces:
Monitored<List<SerializedMessage>>, HasMessageStore, MessageStore, AutoCloseable

public class CollectionMessageStore extends Object implements MessageStore
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 Details

    • CollectionMessageStore

      public CollectionMessageStore()
  • Method Details

    • getBatch

      public List<SerializedMessage> getBatch(Long minIndex, int maxSize, boolean inclusive)
      Description copied from interface: MessageStore
      Retrieves a batch of messages starting from the given minIndex.
      Specified by:
      getBatch in interface MessageStore
      Parameters:
      minIndex - minimum message index to start from
      maxSize - maximum number of messages to retrieve
      inclusive - whether to include the message at minIndex
      Returns:
      a list of SerializedMessage instances
    • registerMonitor

      public Registration registerMonitor(Consumer<List<SerializedMessage>> monitor)
      Description copied from interface: Monitored
      Registers a monitor that will be notified when an activity of type T occurs.
      Specified by:
      registerMonitor in interface Monitored<List<SerializedMessage>>
      Parameters:
      monitor - the callback to invoke with each observed value
      Returns:
      a Registration that can be used to cancel the monitoring
    • append

      public CompletableFuture<Void> append(List<SerializedMessage> messages)
      Description copied from interface: MessageStore
      Appends a list of messages to the store.
      Specified by:
      append in interface MessageStore
      Parameters:
      messages - messages to append
      Returns:
      a CompletableFuture that completes when the messages have been successfully appended
    • setRetentionTime

      public void setRetentionTime(Duration retentionPeriod)
      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 interface MessageStore
      Parameters:
      retentionPeriod - duration to retain messages