Interface StreamableMessageSource<M extends Message<?>>

All Known Subinterfaces:
EventStore
All Known Implementing Classes:
AbstractEventStore, AxonServerEventStore, EmbeddedEventStore, EmbeddedEventStore, MultiStreamableMessageSource, MultiStreamableMessageSource

public interface StreamableMessageSource<M extends Message<?>>
Interface for a source of messages that processors can track.
Author:
Rene de Waele
  • Method Details

    • openStream

      BlockingStream<M> openStream(@Nullable TrackingToken trackingToken)
      Open a stream containing all messages since given tracking token. Pass a trackingToken of null to open a stream containing all available messages. Note that the returned stream is infinite, so beware of applying terminal operations to the returned stream.
      Parameters:
      trackingToken - object containing the position in the stream or null to open a stream containing all messages
      Returns:
      a stream of messages since the given trackingToken
    • createTailToken

      default TrackingToken createTailToken()
      Creates the token at the beginning of an event stream. The beginning of an event stream in this context means the token of very first event in the stream.

      The default behavior for this method is to return null, which always represents the tail position of a stream. However, implementations are encouraged to return an instance that explicitly represents the tail of the stream.

      Returns:
      the token at the beginning of an event stream
    • createHeadToken

      default TrackingToken createHeadToken()
      Creates the token at the end of an event stream. The end of an event stream in this context means the token of very last event in the stream.
      Returns:
      the token at the end of an event stream
      Throws:
      UnsupportedOperationException - if the implementation does not support creating head tokens
    • createTokenAt

      default TrackingToken createTokenAt(Instant dateTime)
      Creates a token that tracks all events after given dateTime. If there is an event exactly at the given dateTime, it will be tracked too.
      Parameters:
      dateTime - The date and time for determining criteria how the tracking token should be created. A tracking token should point at very first event before this date and time.
      Returns:
      a tracking token at the given dateTime, if there aren't events matching this criteria null is returned
      Throws:
      UnsupportedOperationException - if the implementation does not support the creation of time-based tokens
    • createTokenSince

      default TrackingToken createTokenSince(Duration duration)
      Creates a token that tracks all events since the last duration. If there is an event exactly at that time (before given duration), it will be tracked too.
      Parameters:
      duration - The duration for determining criteria how the tracking token should be created. A tracking token should point at very first event before this duration.
      Returns:
      a tracking token that depicts position before given duration, if there aren't events matching this criteria null is returned
      Throws:
      UnsupportedOperationException - if the implementation does not support the creation of time-based tokens