public class SimpleEventBus extends AbstractEventBus
EventBus that supports streaming of events via openStream(TrackingToken) but
only of the most recently published events as it is not backed by a cache or event storage.| Constructor and Description |
|---|
SimpleEventBus()
Initializes an event bus using a
NoOpMessageMonitor and default queue capacity of Integer.MAX_VALUE. |
SimpleEventBus(int queueCapacity,
MessageMonitor<? super EventMessage<?>> messageMonitor)
Initializes an event bus.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterCommit(List<? extends EventMessage<?>> events)
Process given
events after the Unit of Work has been committed. |
TrackingEventStream |
openStream(TrackingToken trackingToken)
This implementation only returns a stream if the specified
trackingToken is null. |
commit, intercept, prepareCommit, publish, queuedMessages, registerDispatchInterceptor, subscribeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateHeadToken, createTailToken, createTokenAt, createTokenSincepublic SimpleEventBus()
NoOpMessageMonitor and default queue capacity of Integer.MAX_VALUE.public SimpleEventBus(int queueCapacity,
MessageMonitor<? super EventMessage<?>> messageMonitor)
messageMonitor to report ingested messages and report the
result of processing the message.queueCapacity - The maximum number of events to hold in memory for event trackingmessageMonitor - The monitor used to monitor the ingested messagesprotected void afterCommit(List<? extends EventMessage<?>> events)
AbstractEventBusevents after the Unit of Work has been committed. The default implementation does
nothing.afterCommit in class AbstractEventBusevents - Events to be published by this Event Buspublic TrackingEventStream openStream(TrackingToken trackingToken)
trackingToken is null. Otherwise it
will throw a UnsupportedOperationException.
The returned stream will receive all events published on the bus from the moment of opening the stream. Note that
the tracking tokens of TrackedEventMessages in the stream will be null;
Open an event stream containing all events since given tracking token. The returned stream is comprised of events
from aggregates as well as other application events. Pass a 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.
trackingToken - object describing the previous position in the stream or null to create a
stream of all eventsTrackingEventStream with events since the given trackingTokenCopyright © 2010–2018. All rights reserved.