Class EmbeddedEventStore
- All Implemented Interfaces:
DomainEventSequenceAware,EventBus,EventStore,MessageDispatchInterceptorSupport<EventMessage<?>>,StreamableMessageSource<TrackedEventMessage<?>>,SubscribableMessageSource<EventMessage<?>>
EventStore that stores and fetches events using an EventStorageEngine. If
supported by its storage engine the embedded event store provides event tracking and replaying capabilities.
The event store can be tracked by multiple event processors simultaneously. To prevent that each event processor
needs to read from the storage engine individually the embedded event store contains a cache of the most recent
events. This cache is shared between the streams of various event processors. So, assuming an event processor
processes events fast enough and is not far behind the head of the event log it will not need a private connection to
the underlying data store. The size of the cache (in number of events) is configurable. This 'event consumption
optimization' might in some scenarios not be desirable, as it will spin up additional threads and perform some
locking operations. Hence it is switchable by using the EmbeddedEventStore.Builder.optimizeEventConsumption(boolean) upon
creation. Additionally, this can also be turned off by providing a system property with key
optimize-event-consumption.
The embedded event store automatically fetches new events from the store if there is at least one registered tracking event processor present. It will do so after new events are committed to the store, as well as periodically as events may have been committed by other nodes or applications. This periodic fetch delay is configurable.
- Since:
- 3.0
- Author:
- Rene de Waele
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Builder class to instantiate anEmbeddedEventStore. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated.Instantiate aEmbeddedEventStorebased on the fields contained in theEmbeddedEventStore.Builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterCommit(List<? extends EventMessage<?>> events) Deprecated.Process giveneventsafter the Unit of Work has been committed.static EmbeddedEventStore.Builderbuilder()Deprecated.Instantiate a Builder to be able to create anEmbeddedEventStore.openStream(TrackingToken trackingToken) Deprecated.Open a stream containing all messages since given tracking token.voidshutDown()Deprecated.Method to invoke when the application shuts down.Methods inherited from class org.axonframework.eventsourcing.eventstore.AbstractEventStore
createHeadToken, createTailToken, createTokenAt, handleSnapshotReadingError, lastSequenceNumberFor, prepareCommit, readEvents, readEvents, stagedDomainEventMessages, storageEngine, storeSnapshotMethods inherited from class org.axonframework.eventhandling.AbstractEventBus
commit, intercept, publish, queuedMessages, registerDispatchInterceptor, subscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.MessageDispatchInterceptorSupport
registerDispatchInterceptorMethods inherited from interface org.axonframework.messaging.StreamableMessageSource
createTokenSinceMethods inherited from interface org.axonframework.messaging.SubscribableMessageSource
subscribe
-
Constructor Details
-
EmbeddedEventStore
Deprecated.Instantiate aEmbeddedEventStorebased on the fields contained in theEmbeddedEventStore.Builder.Will assert that the
EventStorageEngineis notnull, and will throw anAxonConfigurationExceptionif it isnull.- Parameters:
builder- theEmbeddedEventStore.Builderused to instantiate aEmbeddedEventStoreinstance
-
-
Method Details
-
builder
Deprecated.Instantiate a Builder to be able to create anEmbeddedEventStore.The following configurable fields have defaults:
- The
MessageMonitoris defaulted to aNoOpMessageMonitor. - The
EventBusSpanFactoryis defaulted to aDefaultEventBusSpanFactorybacked by aNoOpSpanFactory. - The
cachedEventsis defaulted to10000. - The
fetchDelayis defaulted to1000. - The
cleanupDelayis defaulted to10000. - The
TimeUnitis defaulted toTimeUnit.MILLISECONDS. - The
ThreadFactoryis defaulted toAxonThreadFactorywithThreadGroupTHREAD_GROUP. - The
optimizeEventConsumptionis defaulted totrue.
EventStorageEngineis a hard requirement and as such should be provided.- Returns:
- a Builder to be able to create a
EmbeddedEventStore
- The
-
shutDown
@PreDestroy public void shutDown()Deprecated.Method to invoke when the application shuts down. This closes all event streams used for event store tracking. -
afterCommit
Deprecated.Description copied from class:AbstractEventBusProcess giveneventsafter the Unit of Work has been committed. The default implementation does nothing.- Overrides:
afterCommitin classAbstractEventBus- Parameters:
events- Events to be published by this Event Bus
-
openStream
Deprecated.Description copied from interface:StreamableMessageSourceOpen a stream containing all messages since given tracking token. Pass atrackingTokenofnullto open a stream containing all available messages. Note that the returned stream is infinite, so beware of applying terminal operations to the returned stream.- Parameters:
trackingToken- object containing the position in the stream ornullto open a stream containing all messages- Returns:
- a stream of messages since the given trackingToken
-
EmbeddedEventStorewhich moved to jakarta.