Package org.axonframework.messaging
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 Summary
Modifier and TypeMethodDescriptiondefault TrackingTokenCreates the token at the end of an event stream.default TrackingTokenCreates the token at the beginning of an event stream.default TrackingTokencreateTokenAt(Instant dateTime) Creates a token that tracks all events after givendateTime.default TrackingTokencreateTokenSince(Duration duration) Creates a token that tracks all events since the lastduration.openStream(TrackingToken trackingToken) Open a stream containing all messages since given tracking token.
-
Method Details
-
openStream
Open a stream containing all messages since given tracking token. Pass atrackingTokenofnullto 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 ornullto open a stream containing all messages- Returns:
- a stream of messages since the given 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
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
Creates a token that tracks all events after givendateTime. If there is an event exactly at the givendateTime, 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 criterianullis returned - Throws:
UnsupportedOperationException- if the implementation does not support the creation of time-based tokens
-
createTokenSince
Creates a token that tracks all events since the lastduration. If there is an event exactly at that time (before givenduration), 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 criterianullis returned - Throws:
UnsupportedOperationException- if the implementation does not support the creation of time-based tokens
-