public interface StreamableMessageSource<M extends Message<?>>
messages
that processors can track.Modifier and Type | Method and Description |
---|---|
default TrackingToken |
createHeadToken()
Creates the token at the end of an event stream.
|
default TrackingToken |
createTailToken()
Creates the token at the beginning of an event stream.
|
default TrackingToken |
createTokenAt(Instant dateTime)
Creates a token that tracks all events after given
dateTime . |
default TrackingToken |
createTokenSince(Duration duration)
Creates a token that tracks all events since the last
duration . |
MessageStream<M> |
openStream(TrackingToken trackingToken)
Open a stream containing all messages since given tracking token.
|
MessageStream<M> openStream(TrackingToken trackingToken)
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.trackingToken
- object containing the position in the stream or null
to open a stream containing all
messagesdefault TrackingToken createTailToken()
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.
default TrackingToken createHeadToken()
UnsupportedOperationException
- if the implementation does not support creating head tokensdefault TrackingToken createTokenAt(Instant dateTime)
dateTime
. If there is an event exactly at the given
dateTime
, it will be tracked too.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.dateTime
, if there aren't events matching this criteria null
is returnedUnsupportedOperationException
- if the implementation does not support the creation of time-based tokensdefault TrackingToken createTokenSince(Duration duration)
duration
. If there is an event exactly at that time
(before given duration
), it will be tracked too.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.duration
, if there aren't events matching
this criteria null
is returnedUnsupportedOperationException
- if the implementation does not support the creation of time-based tokensCopyright © 2010–2018. All rights reserved.