public class MultiStreamableMessageSource extends Object implements StreamableMessageSource<TrackedEventMessage<?>>
MultiSourceBlockingStream#hasNextAvailable()
except for the last stream configured by the
MultiStreamableMessageSource.Builder.addMessageSource(String, StreamableMessageSource)
or by explicit
configuration using MultiStreamableMessageSource.Builder.longPollingSource(String)
. This stream long
polls for a fraction of the specified duration before looping through the sources again repeating until the duration
has been met. This ensure the highest chance of a consumable message being found.Modifier and Type | Class and Description |
---|---|
static class |
MultiStreamableMessageSource.Builder
Builder class to instantiate a
MultiStreamableMessageSource . |
Modifier | Constructor and Description |
---|---|
protected |
MultiStreamableMessageSource(MultiStreamableMessageSource.Builder builder)
Instantiate a
MultiStreamableMessageSource based on the fields contained in the
MultiStreamableMessageSource.Builder . |
Modifier and Type | Method and Description |
---|---|
static MultiStreamableMessageSource.Builder |
builder()
Instantiate a Builder to be able to create an
MultiStreamableMessageSource . |
MultiSourceTrackingToken |
createHeadToken()
Creates the token at the end of an event stream.
|
MultiSourceTrackingToken |
createTailToken()
Creates the token at the beginning of an event stream.
|
MultiSourceTrackingToken |
createTokenAt(Instant dateTime)
Creates a token that tracks all events after given
dateTime . |
MultiSourceTrackingToken |
createTokenSince(Duration duration)
Creates a token that tracks all events since the last
duration . |
org.axonframework.eventsourcing.MultiStreamableMessageSource.MultiSourceBlockingStream |
openStream(TrackingToken trackingToken)
Opens a stream for each event source at the specified token position.
|
protected MultiStreamableMessageSource(MultiStreamableMessageSource.Builder builder)
MultiStreamableMessageSource
based on the fields contained in the
MultiStreamableMessageSource.Builder
.
builder
- the MultiStreamableMessageSource.Builder
used to instantiate a
MultiStreamableMessageSource
instance.public static MultiStreamableMessageSource.Builder builder()
MultiStreamableMessageSource
. The configurable field
trackedEventComparator
, which decides which message to process first if there is a choice defaults to the oldest
message available (using the event's timestamp).MultiStreamableMessageSource
.public org.axonframework.eventsourcing.MultiStreamableMessageSource.MultiSourceBlockingStream openStream(TrackingToken trackingToken)
openStream
in interface StreamableMessageSource<TrackedEventMessage<?>>
trackingToken
- object containing the position in the stream or null
to open a stream containing all
messages.MultiSourceBlockingStream
with open streams for each event source.public MultiSourceTrackingToken createTailToken()
StreamableMessageSource
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.
createTailToken
in interface StreamableMessageSource<TrackedEventMessage<?>>
public MultiSourceTrackingToken createHeadToken()
StreamableMessageSource
createHeadToken
in interface StreamableMessageSource<TrackedEventMessage<?>>
public MultiSourceTrackingToken createTokenAt(Instant dateTime)
StreamableMessageSource
dateTime
. If there is an event exactly at the given
dateTime
, it will be tracked too.createTokenAt
in interface StreamableMessageSource<TrackedEventMessage<?>>
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 returnedpublic MultiSourceTrackingToken createTokenSince(Duration duration)
StreamableMessageSource
duration
. If there is an event exactly at that time
(before given duration
), it will be tracked too.createTokenSince
in interface StreamableMessageSource<TrackedEventMessage<?>>
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 returnedCopyright © 2010–2020. All rights reserved.