Package de.otto.synapse.eventsource
Class DefaultEventSource
- java.lang.Object
-
- de.otto.synapse.eventsource.AbstractEventSource
-
- de.otto.synapse.eventsource.DefaultEventSource
-
- All Implemented Interfaces:
EventSource
public class DefaultEventSource extends AbstractEventSource
-
-
Constructor Summary
Constructors Constructor Description DefaultEventSource(MessageStore messageStore, MessageLogReceiverEndpoint messageLog)DefaultEventSource(MessageStore messageStore, MessageLogReceiverEndpoint messageLog, org.slf4j.Marker marker)
-
Method Summary
Modifier and Type Method Description java.util.concurrent.CompletableFuture<ChannelPosition>consumeUntil(java.util.function.Predicate<ShardResponse> stopCondition)Consumes all messages from the EventSource until the predicate returns true.-
Methods inherited from class de.otto.synapse.eventsource.AbstractEventSource
getChannelName, getMessageDispatcher, getMessageLogReceiverEndpoint, isStopping, register, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.otto.synapse.eventsource.EventSource
consume
-
-
-
-
Constructor Detail
-
DefaultEventSource
public DefaultEventSource(@Nonnull MessageStore messageStore, @Nonnull MessageLogReceiverEndpoint messageLog)
-
DefaultEventSource
public DefaultEventSource(@Nonnull MessageStore messageStore, @Nonnull MessageLogReceiverEndpoint messageLog, @Nonnull org.slf4j.Marker marker)
-
-
Method Detail
-
consumeUntil
@Nonnull public java.util.concurrent.CompletableFuture<ChannelPosition> consumeUntil(@Nonnull java.util.function.Predicate<ShardResponse> stopCondition)
Description copied from interface:EventSourceConsumes all messages from the EventSource until the predicate returns true.The registered
consumerswill be called zero or more times, depending on the number of messages retrieved from the EventSource.- Parameters:
stopCondition- the stop condition used to determine whether or not message-consumption should stop- Returns:
- the new read position
-
-