public static class EmbeddedEventStore.Builder extends AbstractEventStore.Builder
EmbeddedEventStore
.
The following configurable fields have defaults:
MessageMonitor
is defaulted to a NoOpMessageMonitor
.SpanFactory
is defaulted to a NoOpSpanFactory
.cachedEvents
is defaulted to 10000
.fetchDelay
is defaulted to 1000
.cleanupDelay
is defaulted to 10000
.TimeUnit
is defaulted to TimeUnit.MILLISECONDS
.ThreadFactory
is defaulted to AxonThreadFactory
with ThreadGroup
EmbeddedEventStore.THREAD_GROUP
.optimizeEventConsumption
is defaulted to true
.EventStorageEngine
is a hard requirement and as such should be provided.storageEngine
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
EmbeddedEventStore |
build()
Initializes a
EmbeddedEventStore as specified through this Builder. |
EmbeddedEventStore.Builder |
cachedEvents(int cachedEvents)
Sets the maximum number of events in the cache that is shared between the streams of tracking event
processors.
|
EmbeddedEventStore.Builder |
cleanupDelay(long cleanupDelay)
Sets the delay between two clean ups of lagging event processors.
|
EmbeddedEventStore.Builder |
fetchDelay(long fetchDelay)
Sets the time to wait before fetching new events from the backing storage engine while tracking after a
previous stream was fetched and read.
|
EmbeddedEventStore.Builder |
messageMonitor(MessageMonitor<? super EventMessage<?>> messageMonitor)
Sets the
MessageMonitor to monitor ingested EventMessage s. |
EmbeddedEventStore.Builder |
optimizeEventConsumption(boolean optimizeEventConsumption)
Sets whether event consumption should be optimized between Event Stream.
|
EmbeddedEventStore.Builder |
spanFactory(SpanFactory spanFactory)
Sets the
SpanFactory implementation to use for providing tracing capabilities. |
EmbeddedEventStore.Builder |
storageEngine(EventStorageEngine storageEngine)
Sets the
EventStorageEngine used to store and load events. |
EmbeddedEventStore.Builder |
threadFactory(ThreadFactory threadFactory)
Sets the
ThreadFactory used to create threads for consuming, producing and cleaning up. |
EmbeddedEventStore.Builder |
timeUnit(TimeUnit timeUnit)
|
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public EmbeddedEventStore.Builder storageEngine(EventStorageEngine storageEngine)
AbstractEventStore.Builder
EventStorageEngine
used to store and load events.storageEngine
in class AbstractEventStore.Builder
storageEngine
- the EventStorageEngine
used to store and load eventspublic EmbeddedEventStore.Builder messageMonitor(@Nonnull MessageMonitor<? super EventMessage<?>> messageMonitor)
AbstractEventBus.Builder
messageMonitor
in class AbstractEventStore.Builder
messageMonitor
- a MessageMonitor
to monitor ingested EventMessage
spublic EmbeddedEventStore.Builder spanFactory(@Nonnull SpanFactory spanFactory)
AbstractEventBus.Builder
SpanFactory
implementation to use for providing tracing capabilities. Defaults to a
NoOpSpanFactory
by default, which provides no tracing capabilities.spanFactory
in class AbstractEventBus.Builder
spanFactory
- The SpanFactory
implementationpublic EmbeddedEventStore.Builder cachedEvents(int cachedEvents)
10000
.cachedEvents
- an int
specifying the maximum number of events in the cache that is shared
between the streams of tracking event processorspublic EmbeddedEventStore.Builder fetchDelay(long fetchDelay)
Defaults to 1000
. Together with the timeUnit
, this will define the exact fetch
delay.
fetchDelay
- a long
specifying the time to wait before fetching new events from the backing
storage engine while tracking after a previous stream was fetched and readpublic EmbeddedEventStore.Builder cleanupDelay(long cleanupDelay)
Defaults to 1000
. Together with the timeUnit
, this will define the exact clean up
delay.
cleanupDelay
- a long
specifying the delay between two clean ups of lagging event processorspublic EmbeddedEventStore.Builder timeUnit(TimeUnit timeUnit)
timeUnit
- the TimeUnit
for the fetchDelay
and cleanupDelay
public EmbeddedEventStore.Builder threadFactory(ThreadFactory threadFactory)
ThreadFactory
used to create threads for consuming, producing and cleaning up. Defaults to a
AxonThreadFactory
with ThreadGroup
EmbeddedEventStore.THREAD_GROUP
.threadFactory
- a ThreadFactory
used to create threads for consuming, producing and cleaning uppublic EmbeddedEventStore.Builder optimizeEventConsumption(boolean optimizeEventConsumption)
true
, distinct
Event Consumers will read events from the same stream as soon as they reach the head of the stream. If false
, they will stay on a private stream. The latter means more database resources will be used, but no
side threads are created to fill the consumer cache nor locking is done on consumer threads. This field can
also be configured by providing a system property with key optimize-event-consumption
. Defaults to
true
.optimizeEventConsumption
- a boolean
defining whether to optimize event consumption of threads
by introducing a Event Cache Production thread tailing the head of the stream
for the consumerspublic EmbeddedEventStore build()
EmbeddedEventStore
as specified through this Builder.EmbeddedEventStore
as specified through this Builderprotected void validate() throws AxonConfigurationException
validate
in class AbstractEventStore.Builder
AxonConfigurationException
- if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2023. All rights reserved.