Interface TrackingTokenSource
- All Known Subinterfaces:
EventStore,StreamableEventSource
- All Known Implementing Classes:
InterceptingEventStore,RecordingEventStore,StorageEngineBackedEventStore
TrackingTokens for the head and tail of the stream, and at a
given point in time in the stream.- Since:
- 5.0.0
- Author:
- Allard Buijze, Mateusz Nowak, Rene de Waele, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionfirstToken(ProcessingContext context) Creates aTrackingTokenrepresenting the first position of theevent stream.latestToken(ProcessingContext context) Creates aTrackingTokenrepresenting the latest position, thus pointing at the next event of theevent stream.tokenAt(Instant at, ProcessingContext context)
-
Method Details
-
firstToken
Creates aTrackingTokenrepresenting the first position of theevent stream.As the retrieved token represents the point from which to
the event stream, the first event to be streamed when opening is the one right after the returned token.invalid reference
openSubsequent invocation of this method will yield the same result, unless the stream's initial values are deleted.
- Parameters:
context- The currentProcessingContext, if any.- Returns:
- A
CompletableFutureof aTrackingTokenrepresenting the first event of theevent stream.
-
latestToken
Creates aTrackingTokenrepresenting the latest position, thus pointing at the next event of theevent stream.As the retrieved token represents the point from which to
the event stream, the first event to be streamed when opening is the one right after the returned token.invalid reference
openSince the
event streamof this source is theoretically infinite, subsequent invocation of this operation typically return a different token. Only if thisStreamableEventSourceis idle, will severallatestToken()invocations result in the sameTrackingToken.- Parameters:
context- The currentProcessingContext, if any.- Returns:
- A
CompletableFutureof aTrackingTokenrepresenting the latest event, thus pointing at the next event of theevent stream.
-
tokenAt
Creates aTrackingTokentracking alleventsafter the givenatfrom anevent stream.When there is an
EventMessageexactly at the givendateTime, it will be tracked too.- Parameters:
at- TheInstantdetermining how theTrackingTokenshould be created. The returned token points at very first event before thisInstant.context- The currentProcessingContext, if any.- Returns:
- A
CompletableFutureofTrackingTokenpointing at the very first event before the givenatof theevent stream.
-