public interface EventBus extends SubscribableMessageSource<EventMessage<?>>, StreamableMessageSource<TrackedEventMessage<?>>, MessageDispatchInterceptorSupport<EventMessage<?>>
EventListener,
SimpleEventBus| Modifier and Type | Method and Description |
|---|---|
TrackingEventStream |
openStream(TrackingToken trackingToken)
Open an event stream containing all events since given tracking token.
|
default void |
publish(EventMessage<?>... events)
Publish a collection of events on this bus (one, or multiple).
|
void |
publish(List<? extends EventMessage<?>> events)
Publish a collection of events on this bus (one, or multiple).
|
Registration |
registerDispatchInterceptor(MessageDispatchInterceptor<? super EventMessage<?>> dispatchInterceptor)
Register the given
interceptor with this bus. |
subscribecreateHeadToken, createTailToken, createTokenAt, createTokenSinceTrackingEventStream openStream(TrackingToken trackingToken)
trackingToken of null to open a
stream containing all available events. Note that the returned stream is infinite, so beware of applying
terminal operations to the returned stream.
In case the event bus cannot open a stream for a given tracking token, for instance because the event bus does
not persist or cache events, the event bus will throw an UnsupportedOperationException.
openStream in interface StreamableMessageSource<TrackedEventMessage<?>>trackingToken - object describing the previous position in the stream or null to create a
stream of all eventsTrackingEventStream with events since the given trackingTokenUnsupportedOperationException - in case this event bus does not support streaming from given tokendefault void publish(EventMessage<?>... events)
Implementations may treat the given events as a single batch and distribute the events as such to
all subscribed EventListeners.
events - The collection of events to publishvoid publish(List<? extends EventMessage<?>> events)
Implementations may treat the given events as a single batch and distribute the events as such to
all subscribed EventListeners.
events - The collection of events to publishRegistration registerDispatchInterceptor(MessageDispatchInterceptor<? super EventMessage<?>> dispatchInterceptor)
interceptor with this bus. When subscribed it will intercept any event messages
published on this bus.
If the given interceptor is already registered, nothing happens.
registerDispatchInterceptor in interface MessageDispatchInterceptorSupport<EventMessage<?>>dispatchInterceptor - The event message dispatch interceptor to registerdispatchInterceptor. When unregistered it will no longer be given
event messages published on this bus.Copyright © 2010–2018. All rights reserved.