public interface EventSource
events.
Event sources can be consumed by consumers.
| Modifier and Type | Method and Description |
|---|---|
default java.util.concurrent.CompletableFuture<ChannelPosition> |
consume()
Consumes all events from the EventSource, until the (current) end of the stream is reached.
|
java.util.concurrent.CompletableFuture<ChannelPosition> |
consumeUntil(java.util.function.Predicate<ShardResponse> stopCondition)
Consumes all messages from the EventSource until the predicate returns true.
|
java.lang.String |
getChannelName()
Returns the name of the EventSource.
|
MessageDispatcher |
getMessageDispatcher()
Returns the MessageDispatcher used by the EventSource to translate and sent incoming messages to the
registered
message consumers. |
MessageLogReceiverEndpoint |
getMessageLogReceiverEndpoint()
Returns the MessageLogReceiverEndpoint used by the
EventSource to consume events. |
boolean |
isStopping() |
void |
register(MessageConsumer<?> messageConsumer)
Registers a new EventConsumer at the EventSource.
|
void |
stop() |
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 EventConsumer@Nonnull MessageDispatcher getMessageDispatcher()
message consumers.@Nonnull MessageLogReceiverEndpoint getMessageLogReceiverEndpoint()
EventSource to consume events.java.lang.String getChannelName()
For streaming event-sources, this is the name of the event stream.
default java.util.concurrent.CompletableFuture<ChannelPosition> consume()
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
@Nonnull java.util.concurrent.CompletableFuture<ChannelPosition> consumeUntil(@Nonnull java.util.function.Predicate<ShardResponse> stopCondition)
The registered consumers will be called zero or more times, depending on
the number of messages retrieved from the EventSource.
stopCondition - the stop condition used to determine whether or not message-consumption should stopvoid stop()
boolean isStopping()