Interface EventSource

All Known Implementing Classes:
AbstractEventSource, DefaultEventSource, DelegateEventSource

public interface EventSource
An event source of events.

Event sources can be consumed by consumers.

  • Method Details

    • register

      void register(MessageConsumer<?> messageConsumer)
      Registers a new EventConsumer at the EventSource. 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)
      Parameters:
      messageConsumer - registered EventConsumer
    • getMessageDispatcher

      @Nonnull MessageDispatcher getMessageDispatcher()
      Returns the MessageDispatcher used by the EventSource to translate and sent incoming messages to the registered message consumers.
      Returns:
      MessageDispatcher
    • getMessageLogReceiverEndpoint

      @Nonnull MessageLogReceiverEndpoint getMessageLogReceiverEndpoint()
      Returns the MessageLogReceiverEndpoint used by the EventSource to consume events.
      Returns:
      MessageLogReceiverEndpoint
    • getChannelName

      String getChannelName()
      Returns the name of the EventSource.

      For streaming event-sources, this is the name of the event stream.

      Returns:
      name
    • consume

      default CompletableFuture<ChannelPosition> consume()
      Consumes all events from the EventSource, 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.

      Returns:
      the new read position
    • consumeUntil

      @Nonnull CompletableFuture<ChannelPosition> consumeUntil(@Nonnull Predicate<ShardResponse> stopCondition)
      Consumes all messages from the EventSource until the predicate returns true.

      The registered consumers will 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
    • stop

      void stop()
    • isStopping

      boolean isStopping()