public class DelegateEventSource extends java.lang.Object implements EventSource
| Constructor and Description |
|---|
DelegateEventSource(java.lang.String messageLogBeanName,
EventSourceBuilder eventSourceBuilder,
org.springframework.context.ApplicationContext applicationContext) |
| Modifier and Type | Method and Description |
|---|---|
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.time.Instant until)
Consumes all events from the EventSource until the timestamp is reached.
|
java.lang.String |
getChannelName()
Returns the name of the EventSource.
|
EventSource |
getDelegate() |
MessageDispatcher |
getMessageDispatcher()
Returns registered EventConsumers.
|
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() |
java.lang.String |
toString() |
public DelegateEventSource(java.lang.String messageLogBeanName,
EventSourceBuilder eventSourceBuilder,
org.springframework.context.ApplicationContext applicationContext)
public EventSource getDelegate()
public 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)
register in interface EventSourcemessageConsumer - the registered EventConsumer@Nonnull public MessageDispatcher getMessageDispatcher()
getMessageDispatcher in interface EventSource@Nonnull public MessageLogReceiverEndpoint getMessageLogReceiverEndpoint()
EventSource to consume events.getMessageLogReceiverEndpoint in interface EventSource@Nonnull public java.lang.String getChannelName()
For streaming event-sources, this is the name of the event stream.
getChannelName in interface EventSourcepublic 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.
consume in interface EventSource@Nonnull public java.util.concurrent.CompletableFuture<ChannelPosition> consumeUntil(@Nonnull java.time.Instant until)
The registered consumers will be called zero or more times, depending on
the number of events retrieved from the EventSource.
consumeUntil in interface EventSourceuntil - the timestamp until the messages should be consumedpublic void stop()
stop in interface EventSourcepublic boolean isStopping()
isStopping in interface EventSourcepublic java.lang.String toString()
toString in class java.lang.Object