public interface EventSource
events.
Event sources can be consumed by consumers.
| Modifier and Type | Method and Description |
|---|---|
default ChannelPosition |
consumeAll()
Consumes all events from the EventSource, until the (current) end of the stream is reached.
|
default ChannelPosition |
consumeAll(ChannelPosition startFrom)
Consumes all events from the EventSource, beginning with
startFrom, until
the (current) end of the stream is reached. |
ChannelPosition |
consumeAll(ChannelPosition startFrom,
java.util.function.Predicate<Message<?>> stopCondition)
Consumes all events from the EventSource, beginning with
startFrom, until
the stopCondition is met. |
default ChannelPosition |
consumeAll(java.util.function.Predicate<Message<?>> stopCondition)
Consumes all events from the EventSource until the
stopCondition is met. |
DispatchingMessageConsumer |
dispatchingMessageConsumer()
Returns registered EventConsumers.
|
java.lang.String |
getName()
An event source's name is used to connect event sources to their consumers.
|
java.lang.String |
getStreamName()
Returns the name of the EventSource.
|
boolean |
isStopping() |
void |
register(MessageConsumer<?> messageConsumer)
Registers a new EventConsumer at the EventSource.
|
void |
stop() |
java.lang.String getName()
void register(MessageConsumer<?> messageConsumer)
consumers have to be thread safe as it may be called from multiple threads
(e.g. for kinesis streams there is one thread per shard)messageConsumer - registered EventConsumerDispatchingMessageConsumer dispatchingMessageConsumer()
java.lang.String getStreamName()
For streaming event-sources, this is the name of the event stream.
default ChannelPosition consumeAll()
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
default ChannelPosition consumeAll(ChannelPosition startFrom)
startFrom, until
the (current) end of the stream is reached.
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
startFrom - the read position returned from earlier executionsdefault ChannelPosition consumeAll(java.util.function.Predicate<Message<?>> stopCondition)
stopCondition is met.
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
stopCondition - the predicate used as a stop conditionChannelPosition consumeAll(ChannelPosition startFrom, java.util.function.Predicate<Message<?>> stopCondition)
startFrom, until
the stopCondition is met.
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
startFrom - the read position returned from earlier executionsstopCondition - the predicate used as a stop conditionvoid stop()
boolean isStopping()