Interface SubscribableEventSource

All Known Subinterfaces:
EventBus, EventStore
All Known Implementing Classes:
DelegatingEventBus, InboundEventMessageChannelAdapter, InterceptingEventBus, InterceptingEventStore, RecordingEventBus, RecordingEventStore, SimpleEventBus, StorageEngineBackedEventStore

public interface SubscribableEventSource
Interface for a source of EventMessages to which event processors can subscribe.

Provides functionality to subscribe event batch consumers to receive events published to this source. When subscribed, consumers will receive all events published to this source since the subscription.

This interface is the replacement for the deprecated SubscribableEventSource, focusing specifically on event message handling.

Since:
5.0.0
Author:
Allard Buijze, Mateusz Nowak, Steven van Beelen
  • Method Details

    • subscribe

      Registration subscribe(@Nonnull BiFunction<List<? extends EventMessage>,ProcessingContext,CompletableFuture<?>> eventsBatchConsumer)
      Subscribe the given eventsBatchConsumer to this event source. When subscribed, it will receive all events published to this source since the subscription.

      If the given eventsBatchConsumer is already subscribed, nothing happens.

      Note on ProcessingContext: The ProcessingContext parameter passed to the consumer may be null. When null, it is the responsibility of the registered eventsBatchConsumer to create an appropriate ProcessingContext as needed for processing the events.

      Parameters:
      eventsBatchConsumer - The event batches consumer to subscribe.
      Returns:
      A Registration handle to unsubscribe the eventsBatchConsumer. When unsubscribed, it will no longer receive events.